Author: bblfish
Date: Wed Nov 10 22:02:40 2010
New Revision: 1033749
URL: http://svn.apache.org/viewvc?rev=1033749&view=rev
Log:
minor whitespace indentation changes. Just to clean up.
Modified:
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.accountcontrolpanel/org.apache.clerezza.platform.accountcontrolpanel.core/pom.xml
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.accountcontrolpanel/org.apache.clerezza.platform.accountcontrolpanel.core/src/main/java/org/apache/clerezza/platform/accountcontrolpanel/ProfilePanel.java
Modified:
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.accountcontrolpanel/org.apache.clerezza.platform.accountcontrolpanel.core/pom.xml
URL:
http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.accountcontrolpanel/org.apache.clerezza.platform.accountcontrolpanel.core/pom.xml?rev=1033749&r1=1033748&r2=1033749&view=diff
==============================================================================
---
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.accountcontrolpanel/org.apache.clerezza.platform.accountcontrolpanel.core/pom.xml
(original)
+++
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.accountcontrolpanel/org.apache.clerezza.platform.accountcontrolpanel.core/pom.xml
Wed Nov 10 22:02:40 2010
@@ -50,10 +50,10 @@
<groupId>org.apache.clerezza</groupId>
<artifactId>org.apache.clerezza.rdf.core</artifactId>
</dependency>
- <dependency>
- <groupId>org.apache.clerezza</groupId>
- <artifactId>org.apache.clerezza.rdf.scala.utils</artifactId>
- </dependency>
+ <dependency>
+ <groupId>org.apache.clerezza</groupId>
+
<artifactId>org.apache.clerezza.rdf.scala.utils</artifactId>
+ </dependency>
<dependency>
<groupId>org.apache.clerezza</groupId>
<artifactId>org.apache.clerezza.rdf.ontologies</artifactId>
@@ -106,10 +106,10 @@
<groupId>org.apache.clerezza</groupId>
<artifactId>org.apache.clerezza.permissiondescriptions</artifactId>
</dependency>
- <dependency>
+ <dependency>
<groupId>org.apache.clerezza</groupId>
<artifactId>org.apache.clerezza.ssl.keygen.base</artifactId>
<version>0.5</version>
- </dependency>
+ </dependency>
</dependencies>
</project>
\ No newline at end of file
Modified:
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.accountcontrolpanel/org.apache.clerezza.platform.accountcontrolpanel.core/src/main/java/org/apache/clerezza/platform/accountcontrolpanel/ProfilePanel.java
URL:
http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.accountcontrolpanel/org.apache.clerezza.platform.accountcontrolpanel.core/src/main/java/org/apache/clerezza/platform/accountcontrolpanel/ProfilePanel.java?rev=1033749&r1=1033748&r2=1033749&view=diff
==============================================================================
---
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.accountcontrolpanel/org.apache.clerezza.platform.accountcontrolpanel.core/src/main/java/org/apache/clerezza/platform/accountcontrolpanel/ProfilePanel.java
(original)
+++
incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.accountcontrolpanel/org.apache.clerezza.platform.accountcontrolpanel.core/src/main/java/org/apache/clerezza/platform/accountcontrolpanel/ProfilePanel.java
Wed Nov 10 22:02:40 2010
@@ -71,26 +71,21 @@ import java.security.interfaces.RSAPubli
@Property(name = "javax.ws.rs", boolValue = true)
@Path("/user/{id}/profile")
public class ProfilePanel extends FileServer {
-
+
private static final Logger logger =
LoggerFactory.getLogger(ProfilePanel.class);
-
@Reference
private UserManager userManager;
-
- @Reference
+ @Reference
private org.apache.clerezza.ssl.keygen.KeygenService keygenSrvc;
@Reference
private TcManager tcManager;
-
@Reference
private RenderletManager renderletManager;
-
@Reference
private WebIdGraphsService webIdGraphsService;
-
@Reference
private PlatformConfig platformConfig;
-
+
protected void activate(ComponentContext componentContext) {
URL templateURL = getClass().getResource("profile-panel.ssp");
renderletManager.registerRenderlet(ScalaServerPagesRenderlet.class.getName(),
@@ -98,7 +93,7 @@ public class ProfilePanel extends FileSe
"naked", MediaType.APPLICATION_XHTML_XML_TYPE,
true);
configure(componentContext.getBundleContext(),
"profile-staticweb");
}
-
+
@GET
public GraphNode getPersonalProfilePage(@Context UriInfo uriInfo,
@PathParam(value = "id") String userName) {
TrailingSlash.enforceNotPresent(uriInfo);
@@ -107,26 +102,26 @@ public class ProfilePanel extends FileSe
resultNode.addProperty(RDF.type, CONTROLPANEL.ProfilePage);
return resultNode;
}
-
+
private GraphNode getPersonalProfile(final String userName, final
UriRef profile) {
return AccessController.doPrivileged(new
PrivilegedAction<GraphNode>() {
@Override
public GraphNode run() {
GraphNode userInSystemGraph =
userManager.getUserInSystemGraph(userName);
- NonLiteral userNodeInSystemGraph =
(NonLiteral)userInSystemGraph.getNode();
+ NonLiteral userNodeInSystemGraph = (NonLiteral)
userInSystemGraph.getNode();
if (userNodeInSystemGraph instanceof BNode) {
//no personal profile without web-id
SimpleMGraph simpleMGraph = new
SimpleMGraph();
GraphNode profileNode = new
GraphNode(new BNode(), simpleMGraph);
-
profileNode.addProperty(CONTROLPANEL.isLocalProfile,
+
profileNode.addProperty(CONTROLPANEL.isLocalProfile,
LiteralFactory.getInstance().createTypedLiteral(true));
UriRef suggestedPPDUri =
getSuggestedPPDUri(userName);
-
profileNode.addProperty(CONTROLPANEL.suggestedPPDUri,
+
profileNode.addProperty(CONTROLPANEL.suggestedPPDUri,
LiteralFactory.getInstance().createTypedLiteral(suggestedPPDUri));
NonLiteral agent = new BNode();
profileNode.addProperty(FOAF.primaryTopic, agent);
- simpleMGraph.add(new TripleImpl(agent,
PLATFORM.userName,
+ simpleMGraph.add(new TripleImpl(agent,
PLATFORM.userName,
LiteralFactory.getInstance().createTypedLiteral(userName)));
return profileNode;
} else {
@@ -138,9 +133,9 @@ public class ProfilePanel extends FileSe
private UriRef getSuggestedPPDUri(String userName) {
return new
UriRef(platformConfig.getDefaultBaseUri().getUnicodeString()
- + "user/" + userName + "/profile");
+ + "user/" + userName + "/profile");
}
-
+
private GraphNode getProfileInUserGraph(UriRef webId, UriRef profile) {
WebIdGraphsService.WebIdGraphs webIdGraphs =
webIdGraphsService.getWebIdGraphs(webId);
MGraph userGraph = webIdGraphs.publicUserGraph();
@@ -148,15 +143,15 @@ public class ProfilePanel extends FileSe
GraphNode userGraphNode = new GraphNode(webId, userGraph);
GraphNode resultNode = new GraphNode(profile,
new UnionMGraph(new SimpleMGraph(),
userGraphNode.getGraph()));
- resultNode.addProperty(CONTROLPANEL.isLocalProfile,
+ resultNode.addProperty(CONTROLPANEL.isLocalProfile,
LiteralFactory.getInstance().createTypedLiteral(webIdGraphs.isLocal()));
resultNode.addProperty(FOAF.primaryTopic,
userGraphNode.getNode());
return resultNode;
}
-
+
@POST
@Path("set-existing-webid")
- public Response setExistingWebId(@Context final UriInfo uriInfo,
+ public Response setExistingWebId(@Context final UriInfo uriInfo,
@FormParam("webid") final UriRef webId,
@PathParam(value = "id") final String userName) {
//TODO check that its not local
//TODO check its not an existing user
@@ -177,7 +172,7 @@ public class ProfilePanel extends FileSe
@PathParam(value = "id") final String userName) {
//TODO check its not an existing user
final UriRef ppd = getSuggestedPPDUri(userName);
- final UriRef webId = new UriRef(ppd.getUnicodeString()+"#me");
+ final UriRef webId = new UriRef(ppd.getUnicodeString() + "#me");
final WebIdGraphsService.WebIdGraphs webIdGraphs =
webIdGraphsService.getWebIdGraphs(webId);
webIdGraphs.localGraph().add(new TripleImpl(ppd,
FOAF.primaryTopic, webId));
webIdGraphs.localGraph().add(new TripleImpl(ppd, RDF.type,
FOAF.PersonalProfileDocument));
@@ -192,15 +187,15 @@ public class ProfilePanel extends FileSe
});
}
- @POST
- @Path("keygen")
+ @POST
+ @Path("keygen")
public Response createCert(@FormParam("webId") UriRef webId,
- @FormParam("cn") String commonName,
- @FormParam("spkac") String spkac,
- @FormParam("crmf") String crmf,
- @FormParam("hours") String hours,
- @FormParam("days") String days,
- @FormParam("csr") String csr) {
+ @FormParam("cn") String commonName,
+ @FormParam("spkac") String spkac,
+ @FormParam("crmf") String crmf,
+ @FormParam("hours") String hours,
+ @FormParam("days") String days,
+ @FormParam("csr") String csr) {
logger.info("in keygen code. webId={}", webId);
logger.info("cn={}", commonName);
@@ -208,38 +203,38 @@ public class ProfilePanel extends FileSe
logger.info("days={}", days);
logger.info("spkac={}", spkac);
logger.info("crmf={}", crmf);
- logger.info("csr={}",csr);
+ logger.info("csr={}", csr);
- Certificate cert = null;
- if (spkac != null && spkac.length() > 0) {
- cert = keygenSrvc.createFromSpkac(spkac);
+ Certificate cert = null;
+ if (spkac != null && spkac.length() > 0) {
+ cert = keygenSrvc.createFromSpkac(spkac);
if (cert == null) {
logger.warn("unable to create certificate from
spkac request");
- }
+ }
}
if (cert == null && crmf != null && crmf.length() > 0) {
cert = keygenSrvc.createFromCRMF(crmf);
- if (cert == null) {
+ if (cert == null) {
logger.warn("unable to create certificate from
crmf requrest :" + crmf);
- }
+ }
}
- if (cert == null && csr != null && csr.length() > 0 ) {
+ if (cert == null && csr != null && csr.length() > 0) {
cert = keygenSrvc.createFromPEM(csr);
if (cert == null) {
- logger.warn("unable to create certificate from
csr request :"+ csr);
+ logger.warn("unable to create certificate from
csr request :" + csr);
}
}
if (cert == null) {
throw new RuntimeException("The server was unable to
craete a certificate");
}
- cert.setSubjectCommonName(commonName);
- cert.addDurationInHours(hours);
- cert.addDurationInDays(days);
+ cert.setSubjectCommonName(commonName);
+ cert.addDurationInHours(hours);
+ cert.addDurationInDays(days);
cert.startEarlier("2"); // start a few hours earlier in order
to remove chances of time synchronisation issues
cert.setSubjectWebID(webId.getUnicodeString());
CertSerialisation ser;
- try {
+ try {
ser = cert.getSerialisation();
} catch (Exception ex) {
throw new RuntimeException(ex);
@@ -255,10 +250,10 @@ public class ProfilePanel extends FileSe
certNode.addPropertyValue(RSA.modulus, modulus);
certNode.addPropertyValue(RSA.public_exponent, publicExponent);
- Response.ResponseBuilder resBuild =
Response.ok(ser.getContent(),MediaType.valueOf(ser.getMimeType()));
- return resBuild.build();
+ Response.ResponseBuilder resBuild =
Response.ok(ser.getContent(), MediaType.valueOf(ser.getMimeType()));
+ return resBuild.build();
- }
+ }
@POST
@Path("modify")