From: <mwl...@us...> - 2008-03-28 20:44:26
|
Revision: 743 http://cishell.svn.sourceforge.net/cishell/?rev=743&view=rev Author: mwlinnem Date: 2008-03-28 13:44:24 -0700 (Fri, 28 Mar 2008) Log Message: ----------- Updated prefs admin for CISHell 1.0 Compatibility. Modified Paths: -------------- branches/user_prefs/org.cishell.reference.prefs.admin/META-INF/MANIFEST.MF branches/user_prefs/org.cishell.reference.prefs.admin/src/org/cishell/reference/prefs/admin/internal/PrefAdminImpl.java branches/user_prefs/org.cishell.reference.prefs.admin/src/org/cishell/reference/prefs/admin/internal/PrefInfoGrabber.java branches/user_prefs/org.cishell.reference.prefs.admin/src/org/cishell/reference/prefs/admin/internal/PrefReferenceProcessor.java Modified: branches/user_prefs/org.cishell.reference.prefs.admin/META-INF/MANIFEST.MF =================================================================== --- branches/user_prefs/org.cishell.reference.prefs.admin/META-INF/MANIFEST.MF 2008-03-28 20:39:23 UTC (rev 742) +++ branches/user_prefs/org.cishell.reference.prefs.admin/META-INF/MANIFEST.MF 2008-03-28 20:44:24 UTC (rev 743) @@ -7,7 +7,7 @@ Import-Package: org.cishell.framework, org.cishell.framework.algorithm, org.cishell.framework.data, - org.cishell.framework.preference, + org.cishell.framework.userprefs, org.cishell.reference.service.metatype, org.osgi.framework;version="1.3.0", org.osgi.service.cm;version="1.2.0", Modified: branches/user_prefs/org.cishell.reference.prefs.admin/src/org/cishell/reference/prefs/admin/internal/PrefAdminImpl.java =================================================================== --- branches/user_prefs/org.cishell.reference.prefs.admin/src/org/cishell/reference/prefs/admin/internal/PrefAdminImpl.java 2008-03-28 20:39:23 UTC (rev 742) +++ branches/user_prefs/org.cishell.reference.prefs.admin/src/org/cishell/reference/prefs/admin/internal/PrefAdminImpl.java 2008-03-28 20:44:24 UTC (rev 743) @@ -6,7 +6,7 @@ import java.util.Enumeration; import java.util.List; -import org.cishell.framework.preference.PreferenceProperty; +import org.cishell.framework.userprefs.UserPrefsProperty; import org.cishell.reference.prefs.admin.PrefAdmin; import org.cishell.reference.prefs.admin.PrefPage; import org.cishell.reference.prefs.admin.PrefsByService; @@ -147,8 +147,8 @@ try { for (int ii = 0; ii < this.prefHolderReferences.size(); ii++) { ServiceReference prefHolder = (ServiceReference) this.prefHolderReferences.get(ii); - if (prefHolder.getProperty(PreferenceProperty.RECEIVE_PREFS_KEY) != null && - prefHolder.getProperty(PreferenceProperty.RECEIVE_PREFS_KEY).equals("true")) { + if (prefHolder.getProperty(UserPrefsProperty.RECEIVE_PREFS_KEY) != null && + prefHolder.getProperty(UserPrefsProperty.RECEIVE_PREFS_KEY).equals("true")) { Configuration localPrefConf = ca.getConfiguration((String) prefHolder.getProperty(Constants.SERVICE_PID)); try { localPrefConf.update(); @@ -163,8 +163,8 @@ } private boolean isFromGlobalConf(String pid) { - return (pid.substring(0, pid.length() - 1).endsWith(PreferenceProperty.GLOBAL_PREFS_CONF_SUFFIX) - || pid.endsWith(PreferenceProperty.GLOBAL_PREFS_CONF_SUFFIX)); + return (pid.substring(0, pid.length() - 1).endsWith(UserPrefsProperty.GLOBAL_PREFS_CONF_SUFFIX) + || pid.endsWith(UserPrefsProperty.GLOBAL_PREFS_CONF_SUFFIX)); } Modified: branches/user_prefs/org.cishell.reference.prefs.admin/src/org/cishell/reference/prefs/admin/internal/PrefInfoGrabber.java =================================================================== --- branches/user_prefs/org.cishell.reference.prefs.admin/src/org/cishell/reference/prefs/admin/internal/PrefInfoGrabber.java 2008-03-28 20:39:23 UTC (rev 742) +++ branches/user_prefs/org.cishell.reference.prefs.admin/src/org/cishell/reference/prefs/admin/internal/PrefInfoGrabber.java 2008-03-28 20:44:24 UTC (rev 743) @@ -7,7 +7,7 @@ import java.util.List; import org.cishell.framework.algorithm.AlgorithmProperty; -import org.cishell.framework.preference.PreferenceProperty; +import org.cishell.framework.userprefs.UserPrefsProperty; import org.cishell.reference.prefs.admin.PreferenceOCD; import org.osgi.framework.Bundle; import org.osgi.framework.Constants; @@ -22,7 +22,7 @@ //NOTE: methods that get configuration objects don't really need the ObjectClassDefinitions. We just use them (hackishly) to know how many configuration objects we should get //Since, there are possibly an infinite number of Configuration objects for a service, we need the ObjectClassDefinitions to tell us when to stop trying to grab configuration objects //(If we try to grab one that didn't previously exist, it will just make an empty one, sometimes we want this behaviour and sometimes we don't). -public class PrefInfoGrabber implements PreferenceProperty, AlgorithmProperty { +public class PrefInfoGrabber implements UserPrefsProperty, AlgorithmProperty { private LogService log; private MetaTypeService mts; @@ -50,38 +50,38 @@ } private String getLocalPrefOCDID(ServiceReference prefHolder) { - String localPrefOCDID = (String) prefHolder.getProperty(PreferenceProperty.LOCAL_PREF_PID); + String localPrefOCDID = (String) prefHolder.getProperty(UserPrefsProperty.LOCAL_PREFS_PID); if (localPrefOCDID != null) { return localPrefOCDID; } else { //no name defined. Use default name. String defaultLocalPrefOCDID = (String) prefHolder.getProperty(Constants.SERVICE_PID) - + PreferenceProperty.LOCAL_PREFS_OCD_SUFFIX; + + UserPrefsProperty.LOCAL_PREFS_OCD_SUFFIX; return defaultLocalPrefOCDID; } } private String getGlobalPrefOCDID(ServiceReference prefHolder) { - String globalPrefOCDID = (String) prefHolder.getProperty(PreferenceProperty.GLOBAL_PREF_PID); + String globalPrefOCDID = (String) prefHolder.getProperty(UserPrefsProperty.GLOBAL_PREFS_PID); if (globalPrefOCDID != null) { return globalPrefOCDID; } else { //no names defined. Use default names. String defaultGlobalPrefOCDID = (String) prefHolder.getProperty(Constants.SERVICE_PID) - + PreferenceProperty.GLOBAL_PREFS_OCD_SUFFIX; + + UserPrefsProperty.GLOBAL_PREFS_OCD_SUFFIX; return defaultGlobalPrefOCDID; } } private String getParamPrefOCDID(ServiceReference prefHolder) { System.out.println(" Getting param pref OCD ID for " + prefHolder.getProperty("service.pid")); - String paramPrefOCDID = (String) prefHolder.getProperty(AlgorithmProperty.PARAMETER_PID); + String paramPrefOCDID = (String) prefHolder.getProperty(AlgorithmProperty.PARAMETERS_PID); if ( paramPrefOCDID != null) { System.out.println(" RETURN override: " + paramPrefOCDID); return paramPrefOCDID; } else { //no names defined. Use default names. - String defaultParamPrefOCDID = (String) prefHolder.getProperty(Constants.SERVICE_PID) + PreferenceProperty.PARAM_PREFS_OCD_SUFFIX; + String defaultParamPrefOCDID = (String) prefHolder.getProperty(Constants.SERVICE_PID) + UserPrefsProperty.PARAM_PREFS_OCD_SUFFIX; System.out.println(" RETURN default: " + defaultParamPrefOCDID); return defaultParamPrefOCDID; } @@ -199,23 +199,23 @@ } private String getGlobalPrefConfID(ServiceReference prefHolder) { - String globalPrefOCDID = (String) prefHolder.getProperty(PreferenceProperty.GLOBAL_PREF_PID); + String globalPrefOCDID = (String) prefHolder.getProperty(UserPrefsProperty.GLOBAL_PREFS_PID); if (globalPrefOCDID != null) { return globalPrefOCDID; } else { //no names defined. Use default names. - String defaultGlobalPrefOCDID = (String) prefHolder.getProperty(Constants.SERVICE_PID) + PreferenceProperty.GLOBAL_PREFS_CONF_SUFFIX; + String defaultGlobalPrefOCDID = (String) prefHolder.getProperty(Constants.SERVICE_PID) + UserPrefsProperty.GLOBAL_PREFS_CONF_SUFFIX; return defaultGlobalPrefOCDID; } } private String getParamPrefConfID(ServiceReference prefHolder) { - String paramPrefOCDID = (String) prefHolder.getProperty(AlgorithmProperty.PARAMETER_PID); + String paramPrefOCDID = (String) prefHolder.getProperty(AlgorithmProperty.PARAMETERS_PID); if ( paramPrefOCDID != null) { return paramPrefOCDID; } else { //no names defined. Use default names. - String defaultGlobalPrefOCDID = (String) prefHolder.getProperty(Constants.SERVICE_PID) + PreferenceProperty.PARAM_PREFS_CONF_SUFFIX; + String defaultGlobalPrefOCDID = (String) prefHolder.getProperty(Constants.SERVICE_PID) + UserPrefsProperty.PARAM_PREFS_CONF_SUFFIX; return defaultGlobalPrefOCDID; } } Modified: branches/user_prefs/org.cishell.reference.prefs.admin/src/org/cishell/reference/prefs/admin/internal/PrefReferenceProcessor.java =================================================================== --- branches/user_prefs/org.cishell.reference.prefs.admin/src/org/cishell/reference/prefs/admin/internal/PrefReferenceProcessor.java 2008-03-28 20:39:23 UTC (rev 742) +++ branches/user_prefs/org.cishell.reference.prefs.admin/src/org/cishell/reference/prefs/admin/internal/PrefReferenceProcessor.java 2008-03-28 20:44:24 UTC (rev 743) @@ -7,7 +7,7 @@ import java.util.Hashtable; import java.util.List; -import org.cishell.framework.preference.PreferenceProperty; +import org.cishell.framework.userprefs.UserPrefsProperty; import org.cishell.reference.prefs.admin.PrefPage; import org.cishell.reference.prefs.admin.PreferenceAD; import org.cishell.reference.prefs.admin.PreferenceOCD; @@ -47,7 +47,7 @@ //get all preference pages from this service by type, and save them by type PrefPage[] localPrefPages = null; - if(isTurnedOn(prefReference, PreferenceProperty.PUBLISH_LOCAL_PREF_VALUE)) { + if(isTurnedOn(prefReference, UserPrefsProperty.PUBLISH_LOCAL_PREFS_VALUE)) { localPrefPages = getLocalPrefPages(prefReference); initializeConfigurations(localPrefPages); this.allLocalPrefPages.addAll(Arrays.asList(localPrefPages)); @@ -55,14 +55,14 @@ } PrefPage[] globalPrefPages = null; - if (isTurnedOn(prefReference, PreferenceProperty.PUBLISH_GLOBAL_PREF_VALUE)) { + if (isTurnedOn(prefReference, UserPrefsProperty.PUBLISH_GLOBAL_PREFS_VALUE)) { globalPrefPages = getGlobalPrefPages(prefReference); initializeConfigurations(globalPrefPages); this.allGlobalPrefPages.addAll(Arrays.asList(globalPrefPages)); } PrefPage[] paramPrefPages = null; - if (isTurnedOn(prefReference,PreferenceProperty.PUBLISH_PARAM_DEFAULT_PREF_VALUE)) { + if (isTurnedOn(prefReference,UserPrefsProperty.PUBLISH_PARAM_DEFAULT_PREFS_VALUE)) { System.out.println(" Attempting to publish param default prefs for " + prefReference.getProperty("service.pid")); paramPrefPages = getParamPrefPages(prefReference); initializeConfigurations(paramPrefPages); @@ -76,7 +76,7 @@ //make sure that preferences are sent to this service if it wants to see them. - if (isTurnedOn(prefReference, PreferenceProperty.RECEIVE_PREFS_KEY)) { + if (isTurnedOn(prefReference, UserPrefsProperty.RECEIVE_PREFS_KEY)) { prefInfoGrabber.ensurePrefsCanBeSentTo(prefReference); } } @@ -158,7 +158,7 @@ } - prefDict.put(PreferenceProperty.BUNDLE_VERSION_KEY, getCurrentBundleVersion(prefPage)); + prefDict.put(UserPrefsProperty.BUNDLE_VERSION_KEY, getCurrentBundleVersion(prefPage)); try { prefConf.update(prefDict); @@ -189,13 +189,13 @@ //only supports 3 publish keys and receive_prefs key private boolean isTurnedOn(ServiceReference prefReference, String processingKey) { - if (processingKey.equals(PreferenceProperty.RECEIVE_PREFS_KEY)) { - String receivePrefsValue = (String) prefReference.getProperty(PreferenceProperty.RECEIVE_PREFS_KEY); + if (processingKey.equals(UserPrefsProperty.RECEIVE_PREFS_KEY)) { + String receivePrefsValue = (String) prefReference.getProperty(UserPrefsProperty.RECEIVE_PREFS_KEY); return receivePrefsValue != null && receivePrefsValue.equals("true"); } else { - String unparsedPublishedPrefsValues = (String) prefReference.getProperty(PreferenceProperty.PREFS_PUBLISHED_KEY); + String unparsedPublishedPrefsValues = (String) prefReference.getProperty(UserPrefsProperty.PREFS_PUBLISHED_KEY); if (unparsedPublishedPrefsValues == null) { - if (processingKey ==PreferenceProperty.PUBLISH_PARAM_DEFAULT_PREF_VALUE) { + if (processingKey ==UserPrefsProperty.PUBLISH_PARAM_DEFAULT_PREFS_VALUE) { return true; } else { return false; @@ -210,7 +210,7 @@ } //makes it so parameter prefs are published by default - if (publishedPrefsValues.length == 0 && processingKey ==PreferenceProperty.PUBLISH_PARAM_DEFAULT_PREF_VALUE) { + if (publishedPrefsValues.length == 0 && processingKey ==UserPrefsProperty.PUBLISH_PARAM_DEFAULT_PREFS_VALUE) { return true; } @@ -236,7 +236,7 @@ private String getCurrentBundleVersion(PrefPage prefPage) { Bundle b = prefPage.getServiceReference().getBundle(); - String currentBundleVersion = (String) b.getHeaders().get(PreferenceProperty.BUNDLE_VERSION_KEY); + String currentBundleVersion = (String) b.getHeaders().get(UserPrefsProperty.BUNDLE_VERSION_KEY); return currentBundleVersion; } @@ -246,13 +246,13 @@ return null; } //no namespace in front of bundle version - String bundleVersionForLocalsAndParams = (String) prefDict.get(PreferenceProperty.BUNDLE_VERSION_KEY); + String bundleVersionForLocalsAndParams = (String) prefDict.get(UserPrefsProperty.BUNDLE_VERSION_KEY); if (bundleVersionForLocalsAndParams != null) { return bundleVersionForLocalsAndParams; } else { //try global kind, with namespace in front String servicePID = (String) prefPage.getServiceReference().getProperty(Constants.SERVICE_PID); - String bundleVersionForGlobals = (String) prefDict.get(servicePID + "." + PreferenceProperty.BUNDLE_VERSION_KEY); + String bundleVersionForGlobals = (String) prefDict.get(servicePID + "." + UserPrefsProperty.BUNDLE_VERSION_KEY); if (bundleVersionForGlobals != null) { return bundleVersionForGlobals; @@ -275,7 +275,7 @@ } private void warnIfReceivePrefsIsNotOn(ServiceReference prefHolder) { - if (! isTurnedOn(prefHolder, PreferenceProperty.RECEIVE_PREFS_KEY)) { + if (! isTurnedOn(prefHolder, UserPrefsProperty.RECEIVE_PREFS_KEY)) { String servicePID = (String) prefHolder.getProperty(Constants.SERVICE_PID); log.log(LogService.LOG_WARNING, "Algorithm Developer Error: \r\n" + "The algorithm " + servicePID + " has published local preferences without requested to receive preferences. \r\n" + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |