You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by am...@apache.org on 2006/04/12 07:21:30 UTC
svn commit: r393387 [2/2] - in /geronimo/branches/1.1:
applications/console-core/src/java/org/apache/geronimo/console/util/
applications/console-framework/src/webapp/WEB-INF/data/
applications/console-standard/ applications/console-standard/src/java/or...
Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationInfo.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationInfo.java?rev=393387&r1=393386&r2=393387&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationInfo.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationInfo.java Tue Apr 11 22:21:19 2006
@@ -20,6 +20,7 @@
import org.apache.geronimo.kernel.management.State;
import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.gbean.AbstractName;
/**
*
@@ -30,18 +31,32 @@
private static final long serialVersionUID = 576134736036202445L;
private final Artifact configID;
private final ConfigurationModuleType type;
+ private final AbstractName storeName;
+ private final Artifact parentID;
private final State state;
- public ConfigurationInfo(Artifact configID, ConfigurationModuleType type) {
+ public ConfigurationInfo(AbstractName storeName, Artifact configID, ConfigurationModuleType type) {
this.configID = configID;
this.type = type;
state = null;
+ this.storeName = storeName;
+ this.parentID = null;
}
- public ConfigurationInfo(Artifact configID, State state, ConfigurationModuleType type) {
+ public ConfigurationInfo(AbstractName storeName, Artifact configID, State state, ConfigurationModuleType type) {
this.configID = configID;
this.state = state;
this.type = type;
+ this.storeName = storeName;
+ this.parentID = null;
+ }
+
+ public ConfigurationInfo(AbstractName storeName, Artifact configID, State state, ConfigurationModuleType type, Artifact parentID) {
+ this.configID = configID;
+ this.state = state;
+ this.type = type;
+ this.storeName = storeName;
+ this.parentID = parentID;
}
public Artifact getConfigID() {
@@ -56,4 +71,11 @@
return type;
}
+ public AbstractName getStoreName() {
+ return storeName;
+ }
+
+ public Artifact getParentID() {
+ return parentID;
+ }
}
Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManager.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManager.java?rev=393387&r1=393386&r2=393387&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManager.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationManager.java Tue Apr 11 22:21:19 2006
@@ -16,16 +16,15 @@
*/
package org.apache.geronimo.kernel.config;
-import org.apache.geronimo.kernel.repository.Artifact;
-
-import javax.management.ObjectName;
import java.io.IOException;
import java.util.List;
+import javax.management.ObjectName;
+import org.apache.geronimo.kernel.repository.Artifact;
/**
* Encapsulates logic for dealing with configurations.
*
- * @version $Rev: 384686 $ $Date$
+ * @version $Rev$ $Date$
*/
public interface ConfigurationManager {
/**
@@ -40,6 +39,12 @@
* @return a List<AbstractName> of the stores this manager controls
*/
List listStores();
+
+ /**
+ * Gets the configuration store responsible for the specified
+ * configuration, or null if there is none.
+ */
+ ConfigurationStore getStoreForConfiguration(Artifact configuration);
/**
* Return a list of the configurations in a specific store.
Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationStore.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationStore.java?rev=393387&r1=393386&r2=393387&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationStore.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/ConfigurationStore.java Tue Apr 11 22:21:19 2006
@@ -25,6 +25,7 @@
import java.util.List;
import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.gbean.AbstractName;
/**
* Interface to a store for Configurations.
@@ -73,6 +74,13 @@
* @return the object name for the store
*/
String getObjectName();
+
+ /**
+ * Return the object name for the store.
+ *
+ * @return the object name for the store
+ */
+ AbstractName getAbstractName();
/**
* Return the configurations in the store
Modified: geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java?rev=393387&r1=393386&r2=393387&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java Tue Apr 11 22:21:19 2006
@@ -28,18 +28,17 @@
import java.util.ListIterator;
import java.util.Map;
import javax.management.ObjectName;
-
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.geronimo.gbean.InvalidConfigurationException;
import org.apache.geronimo.kernel.jmx.JMXUtil;
+import org.apache.geronimo.kernel.management.State;
import org.apache.geronimo.kernel.repository.Artifact;
import org.apache.geronimo.kernel.repository.ArtifactResolver;
import org.apache.geronimo.kernel.repository.Dependency;
import org.apache.geronimo.kernel.repository.Environment;
import org.apache.geronimo.kernel.repository.ImportType;
import org.apache.geronimo.kernel.repository.MissingDependencyException;
-import org.apache.geronimo.kernel.management.State;
/**
* @version $Rev$ $Date$
@@ -80,6 +79,17 @@
return list;
}
+ public ConfigurationStore getStoreForConfiguration(Artifact configuration) {
+ List storeSnapshot = getStores();
+ List result = new ArrayList(storeSnapshot.size());
+ for (int i = 0; i < storeSnapshot.size(); i++) {
+ ConfigurationStore store = (ConfigurationStore) storeSnapshot.get(i);
+ if(store.containsConfiguration(configuration)) {
+ return store;
+ }
+ }
+ return null;
+ }
public List listConfigurations(ObjectName storeName) throws NoSuchStoreException {
List storeSnapshot = getStores();
@@ -97,9 +107,9 @@
for (ListIterator iterator = list.listIterator(); iterator.hasNext();) {
ConfigurationInfo configurationInfo = (ConfigurationInfo) iterator.next();
if (isRunning(configurationInfo.getConfigID())) {
- configurationInfo = new ConfigurationInfo(configurationInfo.getConfigID(), State.RUNNING, configurationInfo.getType());
+ configurationInfo = new ConfigurationInfo(store.getAbstractName(), configurationInfo.getConfigID(), State.RUNNING, configurationInfo.getType());
} else {
- configurationInfo = new ConfigurationInfo(configurationInfo.getConfigID(), State.STOPPED, configurationInfo.getType());
+ configurationInfo = new ConfigurationInfo(store.getAbstractName(), configurationInfo.getConfigID(), State.STOPPED, configurationInfo.getType());
}
iterator.set(configurationInfo);
}
Modified: geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/config/ConfigurationManagerTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/config/ConfigurationManagerTest.java?rev=393387&r1=393386&r2=393387&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/config/ConfigurationManagerTest.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/config/ConfigurationManagerTest.java Tue Apr 11 22:21:19 2006
@@ -142,6 +142,10 @@
throw new UnsupportedOperationException();
}
+ public AbstractName getAbstractName() {
+ throw new UnsupportedOperationException();
+ }
+
public List listConfigurations() {
throw new UnsupportedOperationException();
}
Modified: geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/repository/ArtifactResolverTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/repository/ArtifactResolverTest.java?rev=393387&r1=393386&r2=393387&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/repository/ArtifactResolverTest.java (original)
+++ geronimo/branches/1.1/modules/kernel/src/test/org/apache/geronimo/kernel/repository/ArtifactResolverTest.java Tue Apr 11 22:21:19 2006
@@ -32,6 +32,7 @@
import junit.framework.TestCase;
import org.apache.geronimo.gbean.GBeanInfo;
import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.gbean.AbstractName;
import org.apache.geronimo.kernel.Jsr77Naming;
import org.apache.geronimo.kernel.config.Configuration;
import org.apache.geronimo.kernel.config.ConfigurationData;
@@ -175,6 +176,10 @@
}
public String getObjectName() {
+ return null;
+ }
+
+ public AbstractName getAbstractName() {
return null;
}
Modified: geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/geronimo/J2EEServer.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/geronimo/J2EEServer.java?rev=393387&r1=393386&r2=393387&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/geronimo/J2EEServer.java (original)
+++ geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/geronimo/J2EEServer.java Tue Apr 11 22:21:19 2006
@@ -103,4 +103,15 @@
* @return The ObjectName of the LoginService, in String form.
*/
public LoginService getLoginService();
+
+ /**
+ * Gets the ObjectName of the KeystoreManager associated with this
+ * J2EEServer.
+ *
+ * @see org.apache.geronimo.security.keystore.FileKeystoreManager
+ *
+ * @return The ObjectName of the KeystoreManager, in String form.
+ */
+ public KeystoreManager getKeystoreManager();
+
}
Added: geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/geronimo/KeyIsLocked.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/geronimo/KeyIsLocked.java?rev=393387&view=auto
==============================================================================
--- geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/geronimo/KeyIsLocked.java (added)
+++ geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/geronimo/KeyIsLocked.java Tue Apr 11 22:21:19 2006
@@ -0,0 +1,33 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.management.geronimo;
+
+/**
+ * Exception indicating that the private key you tried to do something with is
+ * locked. It must be unlocked before it can be used in this way.
+ *
+ * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
+ */
+public class KeyIsLocked extends Exception {
+ public KeyIsLocked(String message) {
+ super(message);
+ }
+
+ public KeyIsLocked(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
Added: geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/geronimo/KeystoreInstance.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/geronimo/KeystoreInstance.java?rev=393387&view=auto
==============================================================================
--- geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/geronimo/KeystoreInstance.java (added)
+++ geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/geronimo/KeystoreInstance.java Tue Apr 11 22:21:19 2006
@@ -0,0 +1,133 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.management.geronimo;
+
+import java.security.cert.Certificate;
+
+/**
+ * Management interface for dealing with a specific Keystore
+ *
+ * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
+ */
+public interface KeystoreInstance {
+ /**
+ * Returns the name of the keystore as known to the keystore manager.
+ */
+ public String getKeystoreName();
+
+ /**
+ * Saves a password to access the keystore as a whole. This means that any
+ * other server component can use this keystore to create a socket factory.
+ * However, the relevant private key in the keystore must also be unlocked.
+ *
+ * @return True if the keystore was unlocked successfully
+ */
+ public boolean unlockKeystore(char[] password);
+
+ /**
+ * Clears any saved password, meaning this keystore cannot be used by other
+ * server components. You can still query and update it by passing the
+ * password to other functions,
+ */
+ public void lockKeystore();
+
+ /**
+ * Checks whether this keystore is unlocked, which is to say, available for
+ * other components to use to generate socket factories.
+ * Does not check whether the unlock password is actually correct.
+ */
+ public boolean isKeystoreLocked();
+
+ /**
+ * Gets the aliases of all private key entries in the keystore
+ *
+ * @param storePassword Used to open the keystore.
+ */
+ public String[] listPrivateKeys(char[] storePassword);
+
+ /**
+ * Saves a password to access a private key. This means that if the
+ * keystore is also unlocked, any server component can create an SSL
+ * socket factory using this private key. Note that the keystore
+ * must be unlocked before this can be called.
+ *
+ * @param password The password to save.
+ * @return True if the key was unlocked successfully
+ */
+ public boolean unlockPrivateKey(String alias, char[] password) throws KeystoreIsLocked;
+
+ /**
+ * Clears any saved password for the specified private key, meaning this
+ * key cannot be used for a socket factory by other server components.
+ * You can still query and update it by passing the password to other
+ * functions,
+ */
+ public void lockPrivateKey(String alias);
+
+ /**
+ * Checks whether the specified private key is unlocked, which is to say,
+ * available for other components to use to generate socket factories.
+ * Does not check whether the unlock password is actually correct.
+ */
+ public boolean isKeyUnlocked(String alias);
+
+ /**
+ * Gets the aliases of all trusted certificate entries in the keystore.
+ *
+ * @param storePassword Used to open the keystore.
+ */
+ public String[] listTrustCertificates(char[] storePassword);
+
+ /**
+ * Gets a particular certificate from the keystore. This may be a trust
+ * certificate or the certificate corresponding to a particular private
+ * key.
+ * @param alias The certificate to look at
+ * @param storePassword The password to use to access the keystore
+ */
+ public Certificate getCertificate(String alias, char[] storePassword);
+
+ /**
+ * Adds a certificate to this keystore as a trusted certificate.
+ * @param cert The certificate to add
+ * @param alias The alias to list the certificate under
+ * @param storePassword The password for the keystore
+ * @return True if the certificate was imported successfully
+ */
+ public boolean importTrustCertificate(Certificate cert, String alias, char[] storePassword);
+
+ /**
+ * Generates a new private key and certificate pair in this keystore.
+ * @param alias The alias to store the new key pair under
+ * @param storePassword The password used to access the keystore
+ * @param keyPassword The password to use to protect the new key
+ * @param keyAlgorithm The algorithm used for the key (e.g. RSA)
+ * @param keySize The number of bits in the key (e.g. 1024)
+ * @param signatureAlgorithm The algorithm used to sign the key (e.g. MD5withRSA)
+ * @param validity The number of days the certificate should be valid for
+ * @param commonName The CN portion of the identity on the certificate
+ * @param orgUnit The OU portion of the identity on the certificate
+ * @param organization The O portion of the identity on the certificate
+ * @param locality The L portion of the identity on the certificate
+ * @param state The ST portion of the identity on the certificate
+ * @param country The C portion of the identity on the certificate
+ * @return True if the key was generated successfully
+ */
+ public boolean generateKeyPair(String alias, char[] storePassword, char[] keyPassword, String keyAlgorithm, int keySize,
+ String signatureAlgorithm, int validity, String commonName, String orgUnit,
+ String organization, String locality, String state, String country);
+}
Added: geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/geronimo/KeystoreIsLocked.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/geronimo/KeystoreIsLocked.java?rev=393387&view=auto
==============================================================================
--- geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/geronimo/KeystoreIsLocked.java (added)
+++ geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/geronimo/KeystoreIsLocked.java Tue Apr 11 22:21:19 2006
@@ -0,0 +1,33 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.management.geronimo;
+
+/**
+ * Exception indicating that the keystore you tried to do something with is
+ * locked. It must be unlocked before it can be used in this way.
+ *
+ * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
+ */
+public class KeystoreIsLocked extends Exception {
+ public KeystoreIsLocked(String message) {
+ super(message);
+ }
+
+ public KeystoreIsLocked(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
Added: geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/geronimo/KeystoreManager.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/geronimo/KeystoreManager.java?rev=393387&view=auto
==============================================================================
--- geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/geronimo/KeystoreManager.java (added)
+++ geronimo/branches/1.1/modules/management/src/java/org/apache/geronimo/management/geronimo/KeystoreManager.java Tue Apr 11 22:21:19 2006
@@ -0,0 +1,64 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.management.geronimo;
+
+import javax.net.ServerSocketFactory;
+
+/**
+ * Management interface for working with keystores. Mostly this is used to
+ * identify KeystoreInstances to work with individual keystores.
+ *
+ * @see KeystoreInstance
+ *
+ * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
+ */
+public interface KeystoreManager {
+ /**
+ * Gets the names of the keystores available in the server.
+ */
+ public KeystoreInstance[] getKeystores();
+
+ /**
+ * Gets a ServerSocketFactory using one Keystore to access the private key
+ * and another to provide the list of trusted certificate authorities.
+ * @param keyStore The key keystore name as provided by listKeystores. The
+ * KeystoreInstance for this keystore must be unlocked.
+ * @param keyAlias The name of the private key in the keystore. The
+ * KeystoreInstance for this keystore must have unlocked
+ * this key.
+ * @param trustStore The trust keystore name as provided by listKeystores.
+ * The KeystoreInstance for this keystore must have
+ * unlocked this key.
+ *
+ * @throws KeystoreIsLocked Occurs when the requested key keystore cannot
+ * be used because it has not been unlocked.
+ * @throws KeyIsLocked Occurs when the requested private key in the key
+ * keystore cannot be used because it has not been
+ * unlocked.
+ */
+ public ServerSocketFactory createSSLFactory(String keyStore, String keyAlias, String trustStore)
+ throws KeystoreIsLocked, KeyIsLocked;
+
+ /**
+ * Creates a new, empty keystore. The name should be a valid file name
+ * with no path separator characters.
+ *
+ * @param name The name of the keystore to create
+ * @param password The password to use to protect the new keystore
+ */
+ public KeystoreInstance createKeystore(String name, char[] password);
+}
Modified: geronimo/branches/1.1/modules/security/project.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/security/project.xml?rev=393387&r1=393386&r2=393387&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/security/project.xml (original)
+++ geronimo/branches/1.1/modules/security/project.xml Tue Apr 11 22:21:19 2006
@@ -50,6 +50,15 @@
<dependency>
<groupId>geronimo</groupId>
+ <artifactId>geronimo-util</artifactId>
+ <version>${pom.currentVersion}</version>
+ <properties>
+ <geronimo.dependency>true</geronimo.dependency>
+ </properties>
+ </dependency>
+
+ <dependency>
+ <groupId>geronimo</groupId>
<artifactId>geronimo-core</artifactId>
<version>${pom.currentVersion}</version>
</dependency>
Copied: geronimo/branches/1.1/modules/security/src/java/org/apache/geronimo/security/keystore/FileKeystoreInstance.java (from r388236, geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/keystore/FileKeystoreInstance.java)
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/security/src/java/org/apache/geronimo/security/keystore/FileKeystoreInstance.java?p2=geronimo/branches/1.1/modules/security/src/java/org/apache/geronimo/security/keystore/FileKeystoreInstance.java&p1=geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/keystore/FileKeystoreInstance.java&r1=388236&r2=393387&rev=393387&view=diff
==============================================================================
--- geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/keystore/FileKeystoreInstance.java (original)
+++ geronimo/branches/1.1/modules/security/src/java/org/apache/geronimo/security/keystore/FileKeystoreInstance.java Tue Apr 11 22:21:19 2006
@@ -16,18 +16,6 @@
*/
package org.apache.geronimo.security.keystore;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.geronimo.gbean.DynamicGBean;
-import org.apache.geronimo.gbean.GBeanInfo;
-import org.apache.geronimo.gbean.GBeanInfoBuilder;
-import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
-import org.apache.geronimo.kernel.Kernel;
-import org.apache.geronimo.util.jce.X509Principal;
-import org.apache.geronimo.util.jce.X509V1CertificateGenerator;
-
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
@@ -56,6 +44,19 @@
import java.util.List;
import java.util.Map;
import java.util.Vector;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.gbean.DynamicGBean;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.management.geronimo.KeystoreInstance;
+import org.apache.geronimo.management.geronimo.KeystoreIsLocked;
+import org.apache.geronimo.util.jce.X509Principal;
+import org.apache.geronimo.util.jce.X509V1CertificateGenerator;
/**
* Implementation of KeystoreInstance that accesses a keystore file on the
Copied: geronimo/branches/1.1/modules/security/src/java/org/apache/geronimo/security/keystore/FileKeystoreManager.java (from r388236, geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/keystore/FileKeystoreManager.java)
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/security/src/java/org/apache/geronimo/security/keystore/FileKeystoreManager.java?p2=geronimo/branches/1.1/modules/security/src/java/org/apache/geronimo/security/keystore/FileKeystoreManager.java&p1=geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/keystore/FileKeystoreManager.java&r1=388236&r2=393387&rev=393387&view=diff
==============================================================================
--- geronimo/trunk/modules/security/src/java/org/apache/geronimo/security/keystore/FileKeystoreManager.java (original)
+++ geronimo/branches/1.1/modules/security/src/java/org/apache/geronimo/security/keystore/FileKeystoreManager.java Tue Apr 11 22:21:19 2006
@@ -16,53 +16,47 @@
*/
package org.apache.geronimo.security.keystore;
-import org.apache.geronimo.system.serverinfo.ServerInfo;
-import org.apache.geronimo.gbean.GBeanInfo;
-import org.apache.geronimo.gbean.GBeanInfoBuilder;
-import org.apache.geronimo.gbean.GBeanLifecycle;
-import org.apache.geronimo.gbean.GBeanData;
-import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
-import org.apache.geronimo.j2ee.management.impl.Util;
-import org.apache.geronimo.kernel.config.EditableConfigurationManager;
-import org.apache.geronimo.kernel.config.ConfigurationUtil;
-import org.apache.geronimo.kernel.config.Configuration;
-import org.apache.geronimo.kernel.config.InvalidConfigException;
-import org.apache.geronimo.kernel.Kernel;
-import org.apache.geronimo.util.jce.*;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import javax.net.ServerSocketFactory;
-import javax.management.ObjectName;
-import javax.management.MalformedObjectNameException;
-import java.io.File;
-import java.io.OutputStream;
import java.io.BufferedOutputStream;
+import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
+import java.io.OutputStream;
+import java.math.BigInteger;
import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Hashtable;
-import java.util.Vector;
-import java.util.Date;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
-import java.security.KeyPairGenerator;
-import java.security.KeyPair;
-import java.security.PublicKey;
import java.security.PrivateKey;
-import java.security.SignatureException;
-import java.security.InvalidKeyException;
+import java.security.PublicKey;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
-import java.security.cert.Certificate;
-import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Vector;
+import javax.net.ServerSocketFactory;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.gbean.GBeanLifecycle;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.config.ConfigurationUtil;
+import org.apache.geronimo.kernel.config.EditableConfigurationManager;
+import org.apache.geronimo.kernel.config.InvalidConfigException;
+import org.apache.geronimo.management.geronimo.KeyIsLocked;
+import org.apache.geronimo.management.geronimo.KeystoreInstance;
+import org.apache.geronimo.management.geronimo.KeystoreIsLocked;
+import org.apache.geronimo.management.geronimo.KeystoreManager;
+import org.apache.geronimo.system.serverinfo.ServerInfo;
+import org.apache.geronimo.util.jce.X509Principal;
+import org.apache.geronimo.util.jce.X509V1CertificateGenerator;
/**
* An implementation of KeystoreManager that assumes every file in a specified
@@ -76,14 +70,12 @@
private ServerInfo serverInfo;
private URI configuredDir;
private Collection keystores;
- private ObjectName mine;
private Kernel kernel;
- public FileKeystoreManager(URI keystoreDir, ServerInfo serverInfo, Collection keystores, String objectName, Kernel kernel) throws MalformedObjectNameException {
+ public FileKeystoreManager(URI keystoreDir, ServerInfo serverInfo, Collection keystores, Kernel kernel) {
configuredDir = keystoreDir;
this.serverInfo = serverInfo;
this.keystores = keystores;
- mine = ObjectName.getInstance(objectName);
this.kernel = kernel;
}
@@ -110,7 +102,7 @@
public void doFail() {
}
- public String[] listKeystores() {
+ public String[] listKeystoreFiles() {
File[] files = directory.listFiles();
List list = new ArrayList();
for (int i = 0; i < files.length; i++) {
@@ -122,6 +114,18 @@
return (String[]) list.toArray(new String[list.size()]);
}
+ public KeystoreInstance[] getKeystores() {
+ String[] names = listKeystoreFiles();
+ KeystoreInstance[] result = new KeystoreInstance[names.length];
+ for (int i = 0; i < result.length; i++) {
+ result[i] = getKeystore(names[i]);
+ if(result[i] == null) {
+ return null;
+ }
+ }
+ return result;
+ }
+
public KeystoreInstance getKeystore(String name) {
for (Iterator it = keystores.iterator(); it.hasNext();) {
KeystoreInstance instance = (KeystoreInstance) it.next();
@@ -133,31 +137,20 @@
if(!test.exists() || !test.canRead()) {
throw new IllegalArgumentException("Cannot access keystore "+test.getAbsolutePath()+"!");
}
- ObjectName oName;
- Map props = mine.getKeyPropertyList();
- Hashtable revised = new Hashtable(props);
- revised.put(NameFactory.J2EE_NAME, name);
- revised.put(NameFactory.J2EE_TYPE, NameFactory.KEYSTORE_INSTANCE);
- try {
- oName = ObjectName.getInstance(mine.getDomain(), revised);
- } catch (MalformedObjectNameException e) {
- throw new IllegalArgumentException("Invalid keystore name '"+name+"' ("+e.getMessage()+")");
- }
- GBeanData data = new GBeanData(oName, FileKeystoreInstance.getGBeanInfo());
+ AbstractName aName;
+ AbstractName myName = kernel.getAbstractNameFor(this);
+ aName = kernel.getNaming().createChildName(myName, name, NameFactory.KEYSTORE_INSTANCE);
+ GBeanData data = new GBeanData(aName, FileKeystoreInstance.getGBeanInfo());
data.setAttribute("keystoreFile", test);
data.setAttribute("keystoreName", name);
EditableConfigurationManager mgr = ConfigurationUtil.getEditableConfigurationManager(kernel);
if(mgr != null) {
try {
- ObjectName config = Util.getConfiguration(kernel, mine);
- mgr.addGBeanToConfiguration(Configuration.getConfigurationID(config), data, true);
- return (KeystoreInstance) kernel.getProxyManager().createProxy(oName, KeystoreInstance.class);
+ mgr.addGBeanToConfiguration(myName.getArtifact(), data, true);
+ return (KeystoreInstance) kernel.getProxyManager().createProxy(aName, KeystoreInstance.class);
} catch (InvalidConfigException e) {
log.error("Should never happen", e);
throw new IllegalStateException("Unable to add Keystore GBean ("+e.getMessage()+")");
- } catch (URISyntaxException e) {
- log.error("Should never happen", e);
- throw new IllegalStateException("Unable to add Keystore GBean ("+e.getMessage()+")");
} finally {
ConfigurationUtil.releaseConfigurationManager(kernel, mgr);
}
@@ -201,12 +194,11 @@
static {
GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(FileKeystoreManager.class);
infoFactory.addAttribute("keystoreDir", URI.class, true);
- infoFactory.addAttribute("objectName", String.class, false);
infoFactory.addAttribute("kernel", Kernel.class, false);
infoFactory.addReference("ServerInfo", ServerInfo.class, "GBean");
infoFactory.addReference("KeystoreInstances", KeystoreInstance.class, NameFactory.KEYSTORE_INSTANCE);
infoFactory.addInterface(KeystoreManager.class);
- infoFactory.setConstructor(new String[]{"keystoreDir", "ServerInfo", "KeystoreInstances", "objectName", "kernel"});
+ infoFactory.setConstructor(new String[]{"keystoreDir", "ServerInfo", "KeystoreInstances", "kernel"});
GBEAN_INFO = infoFactory.getBeanInfo();
}
@@ -281,7 +273,6 @@
certgen.setSerialNumber(new BigInteger(String.valueOf(curr)));
// make certificate
- X509Certificate cert = certgen.generateX509Certificate(privateKey);
- return cert;
+ return certgen.generateX509Certificate(privateKey);
}
}
Modified: geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/RepositoryConfigurationStore.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/RepositoryConfigurationStore.java?rev=393387&r1=393386&r2=393387&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/RepositoryConfigurationStore.java (original)
+++ geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/RepositoryConfigurationStore.java Tue Apr 11 22:21:19 2006
@@ -33,6 +33,7 @@
import org.apache.geronimo.gbean.GBeanInfo;
import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.gbean.AbstractName;
import org.apache.geronimo.kernel.Kernel;
import org.apache.geronimo.kernel.config.ConfigurationAlreadyExistsException;
import org.apache.geronimo.kernel.config.ConfigurationData;
@@ -74,6 +75,10 @@
return objectName.toString();
}
+ public AbstractName getAbstractName() {
+ return kernel.getAbstractNameFor(this);
+ }
+
public ConfigurationData loadConfiguration(Artifact configId) throws NoSuchConfigException, IOException, InvalidConfigException {
File location = repository.getLocation(configId);
@@ -244,7 +249,7 @@
ConfigurationData configurationData = loadConfiguration(configId);
ConfigurationModuleType type = configurationData.getModuleType();
- configs.add(new ConfigurationInfo(configId, type));
+ configs.add(new ConfigurationInfo(kernel.getAbstractNameFor(this), configId, type));
} catch (Exception e) {
}
}
Modified: geronimo/branches/1.1/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java?rev=393387&r1=393386&r2=393387&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java (original)
+++ geronimo/branches/1.1/modules/tomcat-builder/src/test/org/apache/geronimo/tomcat/deployment/TomcatModuleBuilderTest.java Tue Apr 11 22:21:19 2006
@@ -402,6 +402,10 @@
return null;
}
+ public AbstractName getAbstractName() {
+ return null;
+ }
+
public List listConfigurations() {
return null;
}