001: /**
002: * Copyright 2005 Sun Microsystems, Inc. All
003: * rights reserved. Use of this product is subject
004: * to license terms. Federal Acquisitions:
005: * Commercial Software -- Government Users
006: * Subject to Standard License Terms and
007: * Conditions.
008: *
009: * Sun, Sun Microsystems, the Sun logo, and Sun ONE
010: * are trademarks or registered trademarks of Sun Microsystems,
011: * Inc. in the United States and other countries.
012: */package com.sun.portal.admin.console.search;
013:
014: import java.util.*;
015: import java.util.logging.Level;
016: import java.io.*;
017:
018: import javax.faces.context.FacesContext;
019: import javax.faces.el.ValueBinding;
020: import javax.servlet.http.HttpServletRequest;
021: import javax.management.*;
022:
023: import com.sun.web.ui.component.*;
024: import com.sun.web.ui.model.*;
025: import com.sun.web.ui.event.*;
026:
027: import com.sun.data.provider.*;
028: import com.sun.data.provider.impl.ObjectListDataProvider;
029:
030: import com.sun.cacao.agent.JmxClient;
031:
032: import com.sun.portal.admin.common.util.AdminClientUtil;
033: import com.sun.portal.admin.console.common.PSBaseBean;
034:
035: public class EditAutoclassifyBean extends PSBaseBean {
036:
037: public String databasePath = "";
038: public String rdInMemory = "";
039:
040: public EditAutoclassifyBean() {
041: retrieve();
042: }
043:
044: public String getDatabasePath() {
045: return databasePath;
046: }
047:
048: public void setDatabasePath(String s) {
049: this .databasePath = s;
050: }
051:
052: public String getRdInMemory() {
053: return rdInMemory;
054: }
055:
056: public void setRdInMemory(String rdInMemory) {
057: this .rdInMemory = rdInMemory;
058: }
059:
060: public String save() {
061: try {
062: LinkedList path = new LinkedList();
063: path.addFirst(AdminClientUtil.DEFAULT_DOMAIN);
064: path
065: .addFirst((String) getSessionAttribute("search.server.selected"));
066: path.addFirst("autoclassify");
067: ObjectName on = AdminClientUtil.getResourceMBeanObjectName(
068: AdminClientUtil.SEARCH_AUTOCLASSIFY_MBEAN_TYPE,
069: path);
070: Object[] params = { "", databasePath, rdInMemory };
071: String[] signature = { "java.lang.String",
072: "java.lang.String", "java.lang.String" };
073: getMBeanServerConnection().invoke(on, "setConfig", params,
074: signature);
075: } catch (Exception e) {
076: log(Level.SEVERE,
077: "EditAutoclassifyBean.save() : Exception ", e);
078: }
079: retrieve();
080: return "gotoCategoriesAutoclassifyHome";
081: }
082:
083: public String reset() {
084: retrieve();
085: return "gotoCategoriesAutoclassifyHome";
086: }
087:
088: private void retrieve() {
089: try {
090: LinkedList path = new LinkedList();
091: path.addFirst(AdminClientUtil.DEFAULT_DOMAIN);
092: path
093: .addFirst((String) getSessionAttribute("search.server.selected"));
094: path.addFirst("autoclassify");
095: ObjectName on = AdminClientUtil.getResourceMBeanObjectName(
096: AdminClientUtil.SEARCH_AUTOCLASSIFY_MBEAN_TYPE,
097: path);
098: Object[] params = {};
099: String[] signatures = {};
100: HashMap hm = (HashMap) getMBeanServerConnection().invoke(
101: on, "retrieveConfig", params, signatures);
102: if (hm != null) {
103: databasePath = (String) hm.get("DbPath");
104: rdInMemory = (String) hm.get("HashSize");
105: }
106: } catch (Exception e) {
107: log(
108: Level.SEVERE,
109: "EditAutoclassifyBean.generateAutoclassifyConfig() : Exception ",
110: e);
111: }
112: }
113:
114: }
|