User: d_jencks
Date: 01/08/20 20:27:20
Modified: src/main/org/jboss/resource/security
ManyToOnePrincipalMapping.java
PrincipalMapping.java PrincipalMappingSupport.java
Log:
fixed JavaStyle (ant pretty task) generated formatting to match jboss standards (I
think)
Revision Changes Path
1.4 +77 -33
jbosscx/src/main/org/jboss/resource/security/ManyToOnePrincipalMapping.java
Index: ManyToOnePrincipalMapping.java
===================================================================
RCS file:
/cvsroot/jboss/jbosscx/src/main/org/jboss/resource/security/ManyToOnePrincipalMapping.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ManyToOnePrincipalMapping.java 2001/08/19 04:55:29 1.3
+++ ManyToOnePrincipalMapping.java 2001/08/21 03:27:20 1.4
@@ -1,5 +1,5 @@
/*
- * JBoss, the OpenSource EJB server
+ * JBoss, the OpenSource J2EE webOS
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
@@ -26,19 +26,19 @@
* is not set then the <code>userName</code> is used.
*
* @author Toby Allsopp ([EMAIL PROTECTED])
- * @created August 19, 2001
* @see org.jboss.resource.ConnectionManagerImpl
- * @version $Revision: 1.3 $
+ * @version $Revision: 1.4 $
*/
public class ManyToOnePrincipalMapping
- extends PrincipalMappingSupport {
+ extends PrincipalMappingSupport
+{
// Constants -----------------------------------------------------
// Attributes ----------------------------------------------------
private Principal resourcePrincipal;
- private String userName;
- private String password;
+ private String userName;
+ private String password;
// Static --------------------------------------------------------
@@ -48,43 +48,57 @@
// PrincipalMappingSupport overrides -----------------------------
- public Subject createSubject( Principal callerPrincipal ) {
- if ( userName == null ) {
+ /**
+ * #Description of the Method
+ *
+ * @param callerPrincipal Description of Parameter
+ * @return Description of the Returned Value
+ */
+ public Subject createSubject(Principal callerPrincipal)
+ {
+ if (userName == null)
+ {
return null;
}
Subject subject = new Subject();
- subject.getPrincipals().add( resourcePrincipal );
+ subject.getPrincipals().add(resourcePrincipal);
- if ( metadata.getAuthMechType().equals( "BasicPassword" ) ) {
+ if (metadata.getAuthMechType().equals("BasicPassword"))
+ {
// The spec says that we need a new instance of this every
// time, because it is specific to a managed connection
// factory instance. We could probably get away with caching
// one per MCF, but who really cares?
PasswordCredential cred =
- new PasswordCredential( userName, password.toCharArray() );
- cred.setManagedConnectionFactory( mcf );
- subject.getPrivateCredentials().add( cred );
- } else {
- throw new RuntimeException( "Unsupported authentication-mechanism-type: '"
+
- metadata.getAuthMechType() + "'" );
+ new PasswordCredential(userName, password.toCharArray());
+ cred.setManagedConnectionFactory(mcf);
+ subject.getPrivateCredentials().add(cred);
+ }
+ else
+ {
+ throw new RuntimeException("Unsupported authentication-mechanism-type: '" +
+ metadata.getAuthMechType() + "'");
}
return subject;
}
- protected void afterSetProperties() {
- userName = ( String )properties.get( "userName" );
- password = ( String )properties.get( "password" );
- if ( password == null ) {
+ protected void afterSetProperties()
+ {
+ userName = (String)properties.get("userName");
+ password = (String)properties.get("password");
+ if (password == null)
+ {
password = "";
}
- String principalName = ( String )properties.get( "principalName" );
- if ( principalName == null ) {
+ String principalName = (String)properties.get("principalName");
+ if (principalName == null)
+ {
principalName = userName;
}
- resourcePrincipal = new ResourcePrincipal( principalName );
+ resourcePrincipal = new ResourcePrincipal(principalName);
}
// Package protected ---------------------------------------------
@@ -96,33 +110,63 @@
// Inner classes -------------------------------------------------
/**
- * @created August 19, 2001
+ *
*/
private static class ResourcePrincipal
- implements Principal {
+ implements Principal
+ {
private final String name;
- private ResourcePrincipal( String name ) {
+ private ResourcePrincipal(String name)
+ {
this.name = name;
}
- public String getName() {
+ /**
+ * Gets the Name attribute of the ResourcePrincipal object
+ *
+ * @return The Name value
+ */
+ public String getName()
+ {
return name;
}
- public int hashCode() {
+ /**
+ * #Description of the Method
+ *
+ * @return Description of the Returned Value
+ */
+ public int hashCode()
+ {
return name.hashCode();
}
- public boolean equals( Object other ) {
- if ( other instanceof ResourcePrincipal ) {
- return ( ( ResourcePrincipal )other ).name.equals( name );
- } else {
+ /**
+ * #Description of the Method
+ *
+ * @param other Description of Parameter
+ * @return Description of the Returned Value
+ */
+ public boolean equals(Object other)
+ {
+ if (other instanceof ResourcePrincipal)
+ {
+ return ((ResourcePrincipal)other).name.equals(name);
+ }
+ else
+ {
return false;
}
}
- public String toString() {
+ /**
+ * #Description of the Method
+ *
+ * @return Description of the Returned Value
+ */
+ public String toString()
+ {
return name;
}
1.3 +9 -9
jbosscx/src/main/org/jboss/resource/security/PrincipalMapping.java
Index: PrincipalMapping.java
===================================================================
RCS file:
/cvsroot/jboss/jbosscx/src/main/org/jboss/resource/security/PrincipalMapping.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- PrincipalMapping.java 2001/08/19 04:55:29 1.2
+++ PrincipalMapping.java 2001/08/21 03:27:20 1.3
@@ -1,5 +1,5 @@
/*
- * JBoss, the OpenSource EJB server
+ * JBoss, the OpenSource J2EE webOS
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
@@ -24,11 +24,11 @@
*
* @author Toby Allsopp ([EMAIL PROTECTED])
* @author <a href="mailto:[EMAIL PROTECTED]">David Jencks</a>
- * @created August 19, 2001
* @see org.jboss.resource.ConnectionManagerImpl
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
*/
-public interface PrincipalMapping {
+public interface PrincipalMapping
+{
// Constants -----------------------------------------------------
// Public --------------------------------------------------------
@@ -38,14 +38,14 @@
*
* @param name The new Name value
*/
- void setName( String name );
+ void setName(String name);
/**
* Sets the managed connection factory for which principals will be mapped.
*
* @param mcf The new ManagedConnectionFactory value
*/
- void setManagedConnectionFactory( ManagedConnectionFactory mcf );
+ void setManagedConnectionFactory(ManagedConnectionFactory mcf);
/**
* Sets the meta-data that describes the resource adapter for which
@@ -53,7 +53,7 @@
*
* @param metadata The new RARMetaData value
*/
- void setRARMetaData( RARMetaData metadata );
+ void setRARMetaData(RARMetaData metadata);
/**
* Sets configuration information for a particular implementation of this
@@ -64,7 +64,7 @@
* @param properties The new Properties value
* @see java.util.Properties#load
*/
- void setProperties( String properties );
+ void setProperties(String properties);
/**
* Creates a <code>Subject</code> that contains the resource principal and
@@ -77,5 +77,5 @@
* single principal, the mapped resource principal, and whatever
* credentials are required for EIS sign-on
*/
- Subject createSubject( Principal callerPrincipal );
+ Subject createSubject(Principal callerPrincipal);
}
1.3 +44 -15
jbosscx/src/main/org/jboss/resource/security/PrincipalMappingSupport.java
Index: PrincipalMappingSupport.java
===================================================================
RCS file:
/cvsroot/jboss/jbosscx/src/main/org/jboss/resource/security/PrincipalMappingSupport.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- PrincipalMappingSupport.java 2001/08/19 04:55:29 1.2
+++ PrincipalMappingSupport.java 2001/08/21 03:27:20 1.3
@@ -1,5 +1,5 @@
/*
- * JBoss, the OpenSource EJB server
+ * JBoss, the OpenSource J2EE webOS
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
@@ -25,11 +25,11 @@
*
* @author Toby Allsopp ([EMAIL PROTECTED])
* @author <a href="mailto:[EMAIL PROTECTED]">David Jencks</a>
- * @created August 19, 2001
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
*/
public abstract class PrincipalMappingSupport
- implements PrincipalMapping {
+ implements PrincipalMapping
+{
// Constants -----------------------------------------------------
// Attributes ----------------------------------------------------
@@ -47,26 +47,54 @@
// PrincipalMapping implementation -------------------------------
- public void setName( String name ) {
- category = ( JBossCategory )JBossCategory.getInstance( getClass().getName() +
"." + name );
+ /**
+ * Sets the Name attribute of the PrincipalMappingSupport object
+ *
+ * @param name The new Name value
+ */
+ public void setName(String name)
+ {
+ category = (JBossCategory)JBossCategory.getInstance(getClass().getName() +
"." + name);
}
- public void setManagedConnectionFactory( ManagedConnectionFactory mcf ) {
+ /**
+ * Sets the ManagedConnectionFactory attribute of the PrincipalMappingSupport
+ * object
+ *
+ * @param mcf The new ManagedConnectionFactory value
+ */
+ public void setManagedConnectionFactory(ManagedConnectionFactory mcf)
+ {
this.mcf = mcf;
}
- public void setRARMetaData( RARMetaData metadata ) {
+ /**
+ * Sets the RARMetaData attribute of the PrincipalMappingSupport object
+ *
+ * @param metadata The new RARMetaData value
+ */
+ public void setRARMetaData(RARMetaData metadata)
+ {
this.metadata = metadata;
}
- public void setProperties( String propStr ) {
+ /**
+ * Sets the Properties attribute of the PrincipalMappingSupport object
+ *
+ * @param propStr The new Properties value
+ */
+ public void setProperties(String propStr)
+ {
properties = new Properties();
- try {
+ try
+ {
properties.load(
- new ByteArrayInputStream( propStr.getBytes( "ISO-8859-1" ) ) );
- } catch ( IOException ioe ) {
- category.error( "Couldn't convert properties string '" + propStr + "' to "
+
- "Properties", ioe );
+ new ByteArrayInputStream(propStr.getBytes("ISO-8859-1")));
+ }
+ catch (IOException ioe)
+ {
+ category.error("Couldn't convert properties string '" + propStr + "' to " +
+ "Properties", ioe);
}
afterSetProperties();
}
@@ -79,7 +107,8 @@
* Called once the <code>properties</code> field has been initialised and
* populated.
*/
- protected void afterSetProperties() {
+ protected void afterSetProperties()
+ {
}
// Private -------------------------------------------------------
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development