Finish ProfileData class
diff --git a/src/exception.cpp b/src/exception.cpp
new file mode 100644
index 0000000..22f89a1
--- /dev/null
+++ b/src/exception.cpp
@@ -0,0 +1,17 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2013, Regents of the University of California
+ *                     Yingdi Yu
+ *
+ * BSD license, See the LICENSE file for more information
+ *
+ * Author: Yingdi Yu <yingdi@cs.ucla.edu>
+ */
+
+#include "exception.h"
+
+using namespace std;
+
+LnException::LnException(const string & errMsg) throw()
+  : m_errMsg(errMsg)
+{}
diff --git a/src/exception.h b/src/exception.h
new file mode 100644
index 0000000..fbd1812
--- /dev/null
+++ b/src/exception.h
@@ -0,0 +1,33 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2013, Regents of the University of California
+ *                     Yingdi Yu
+ *
+ * BSD license, See the LICENSE file for more information
+ *
+ * Author: Yingdi Yu <yingdi@cs.ucla.edu>
+ */
+
+#ifndef LINKEDN_EXCEPTION_H
+#define LINKEDN_EXCEPTION_H
+
+#include <exception>
+#include <string>
+
+class LnException : public std::exception
+{
+public:
+  LnException(const std::string & errMsg) throw();
+  
+  ~LnException() throw()
+  {}
+  
+  inline const std::string& 
+  msg() const 
+  {return m_errMsg;}
+  
+private:
+  const std::string m_errMsg;
+};
+
+#endif
diff --git a/src/profile-data.cpp b/src/profile-data.cpp
index e111e54..f4b6bde 100644
--- a/src/profile-data.cpp
+++ b/src/profile-data.cpp
@@ -9,6 +9,9 @@
  */
 
 #include "profile-data.h"
+#include "exception.h"
+
+#include <ndn.cxx/fields/signature-sha256-with-rsa.h>
 
 using namespace std;
 using namespace ndn;
@@ -34,11 +37,43 @@
   setName(profile.getName());
   setContent(profile.getContent());
 }
-
-Ptr<ProfileData> 
-ProfileData::fromData (const Data& data)
+ 
+ProfileData::ProfileData (const Data& data)
+  : Data()
 {
-  //TODO:
-  return NULL;
+  const Name& dataName = data.getName();
+  name::Component appFlag(string("PROFILE"));  
+
+  int profileIndex = -1;
+  for(int i = 0; i < dataName.size(); i++)
+    {
+      if(0 == dataName.get(i).compare(appFlag))
+	{
+	  profileIndex = i;
+	  break;
+	}
+    }
+
+  if(profileIndex < 0 || profileIndex + 1 >= dataName.size())
+    throw LnException("No PROFILE component in data name!");
+  
+  Ptr<const signature::Sha256WithRsa> dataSig = boost::dynamic_pointer_cast<const signature::Sha256WithRsa>(data.getSignature());
+  Ptr<signature::Sha256WithRsa> newSig = Ptr<signature::Sha256WithRsa>::Create();
+
+  Ptr<SignedBlob> newSignedBlob = NULL;
+  if(data.getSignedBlob() != NULL)
+    newSignedBlob = Ptr<SignedBlob>(new SignedBlob(*data.getSignedBlob()));
+    
+  newSig->setKeyLocator(dataSig->getKeyLocator());
+  newSig->setPublisherKeyDigest(dataSig->getPublisherKeyDigest());
+  newSig->setSignatureBits(dataSig->getSignatureBits());
+  
+  setName(data.getName());
+  setSignature(newSig);
+  setContent(data.getContent());
+  setSignedBlob(newSignedBlob);
+
+  m_identityName = dataName.getSubName(0, profileIndex);
+  m_profileType = dataName.get(profileIndex+1).toUri();
 }
 
diff --git a/src/profile-data.h b/src/profile-data.h
index a1e71cf..6e29a43 100644
--- a/src/profile-data.h
+++ b/src/profile-data.h
@@ -22,10 +22,9 @@
 
   ProfileData (const ProfileData& profile);
 
-  ~ProfileData () {}
+  ProfileData (const ndn::Data& data);
 
-  static ndn::Ptr<ProfileData> 
-  fromData (const ndn::Data& data);
+  ~ProfileData () {}
 
   inline const ndn::Name&
   getIdentityName() const