TBR

v: renaming the v directory to go

Change-Id: I4fd9f6ee2895d8034c23b65927eb118980b3c17a
diff --git a/services/mgmt/profile/impl/dispatcher.go b/services/mgmt/profile/impl/dispatcher.go
new file mode 100644
index 0000000..b85e12e
--- /dev/null
+++ b/services/mgmt/profile/impl/dispatcher.go
@@ -0,0 +1,31 @@
+package impl
+
+import (
+	"veyron/services/mgmt/profile"
+
+	"veyron2/ipc"
+	"veyron2/security"
+	"veyron2/storage"
+	"veyron2/storage/vstore"
+)
+
+// dispatcher holds the state of the profile manager dispatcher.
+type dispatcher struct {
+	store storage.Store
+}
+
+// NewDispatcher is the dispatcher factory.
+func NewDispatcher(name string) (*dispatcher, error) {
+	store, err := vstore.New(name)
+	if err != nil {
+		return nil, err
+	}
+	return &dispatcher{store: store}, nil
+}
+
+// DISPATCHER INTERFACE IMPLEMENTATION
+
+func (d *dispatcher) Lookup(suffix string) (ipc.Invoker, security.Authorizer, error) {
+	invoker := ipc.ReflectInvoker(profile.NewServerProfile(NewInvoker(d.store, suffix)))
+	return invoker, nil, nil
+}
diff --git a/services/mgmt/profile/impl/impl_test.go b/services/mgmt/profile/impl/impl_test.go
new file mode 100644
index 0000000..cfe4208
--- /dev/null
+++ b/services/mgmt/profile/impl/impl_test.go
@@ -0,0 +1,105 @@
+package impl
+
+import (
+	"reflect"
+	"testing"
+
+	"veyron/services/mgmt/profile"
+	istore "veyron/services/store/testutil"
+
+	"veyron2/rt"
+)
+
+var (
+	// spec is an example profile specification used throughout the test.
+	spec = profile.Specification{
+		Format:      profile.Format{Name: "elf", Attributes: map[string]string{"os": "linux", "arch": "amd64"}},
+		Libraries:   map[profile.Library]struct{}{profile.Library{Name: "foo", MajorVersion: "1", MinorVersion: "0"}: struct{}{}},
+		Label:       "example",
+		Description: "Example profile to test the profile manager implementation.",
+	}
+)
+
+// TestInterface tests that the implementation correctly implements
+// the Profile interface.
+func TestInterface(t *testing.T) {
+	runtime := rt.Init()
+	defer runtime.Shutdown()
+
+	// Setup and start the profile manager server.
+	server, err := runtime.NewServer()
+	if err != nil {
+		t.Fatalf("NewServer() failed: %v", err)
+	}
+
+	// Setup and start a store server.
+	mountPoint, cleanup := istore.NewStore(t, server, runtime.Identity().PublicID())
+	defer cleanup()
+
+	dispatcher, err := NewDispatcher(mountPoint)
+	if err != nil {
+		t.Fatalf("NewDispatcher() failed: %v", err)
+	}
+	suffix := ""
+	if err := server.Register(suffix, dispatcher); err != nil {
+		t.Fatalf("Register(%v, %v) failed: %v", suffix, dispatcher, err)
+	}
+	protocol, hostname := "tcp", "localhost:0"
+	endpoint, err := server.Listen(protocol, hostname)
+	if err != nil {
+		t.Fatalf("Listen(%v, %v) failed: %v", protocol, hostname, err)
+	}
+	name := ""
+	if err := server.Publish(name); err != nil {
+		t.Fatalf("Publish(%v) failed: %v", name, err)
+	}
+	t.Logf("Profile manager published at %v/%v", endpoint, name)
+
+	// Create client stubs for talking to the server.
+	stub, err := profile.BindProfile("/" + endpoint.String() + "/linux/base")
+	if err != nil {
+		t.Fatalf("BindApplication() failed: %v", err)
+	}
+
+	// Put
+	if err := stub.Put(spec); err != nil {
+		t.Fatalf("Put() failed: %v", err)
+	}
+
+	// Label
+	label, err := stub.Label()
+	if err != nil {
+		t.Fatalf("Label() failed: %v", err)
+	}
+	if label != spec.Label {
+		t.Fatalf("Unexpected output: expected %v, got %v", spec.Label, label)
+	}
+
+	// Description
+	description, err := stub.Description()
+	if err != nil {
+		t.Fatalf("Description() failed: %v", err)
+	}
+	if description != spec.Description {
+		t.Fatalf("Unexpected output: expected %v, got %v", spec.Description, description)
+	}
+
+	// Specification
+	specification, err := stub.Specification()
+	if err != nil {
+		t.Fatalf("Specification() failed: %v", err)
+	}
+	if !reflect.DeepEqual(spec, specification) {
+		t.Fatalf("Unexpected output: expected %v, got %v", spec, specification)
+	}
+
+	// Remove
+	if err := stub.Remove(); err != nil {
+		t.Fatalf("Remove() failed: %v", err)
+	}
+
+	// Shutdown the content manager server.
+	if err := server.Stop(); err != nil {
+		t.Fatalf("Stop() failed: %v", err)
+	}
+}
diff --git a/services/mgmt/profile/impl/invoker.go b/services/mgmt/profile/impl/invoker.go
new file mode 100644
index 0000000..f8e7a95
--- /dev/null
+++ b/services/mgmt/profile/impl/invoker.go
@@ -0,0 +1,131 @@
+package impl
+
+import (
+	"errors"
+	"path"
+
+	"veyron/services/mgmt/profile"
+
+	"veyron2/ipc"
+	"veyron2/storage"
+	"veyron2/storage/vstore"
+	"veyron2/vlog"
+)
+
+// invoker holds the profile manager invocation.
+type invoker struct {
+	// store is the storage server used for storing profile data.
+	store storage.Store
+	// suffix is the suffix of the current invocation that is assumed to
+	// be used as a relative veyron name to identify a profile
+	// specification.
+	suffix string
+}
+
+var (
+	errNotFound        = errors.New("not found")
+	errOperationFailed = errors.New("operation failed")
+)
+
+// NewInvoker is the invoker factory.
+func NewInvoker(store storage.Store, suffix string) *invoker {
+	return &invoker{store: store, suffix: suffix}
+}
+
+// STORE MANAGEMENT INTERFACE IMPLEMENTATION
+
+// dir is used to organize directory contents in the store.
+type dir struct{}
+
+// makeParentNodes creates the parent nodes if they do not already exist.
+func makeParentNodes(store storage.Store, transaction storage.Transaction, path string) error {
+	pathComponents := storage.ParsePath(path)
+	for i := 0; i < len(pathComponents); i++ {
+		name := pathComponents[:i].String()
+		object := store.Bind(name)
+		if _, err := object.Get(transaction); err != nil {
+			if _, err := object.Put(transaction, &dir{}); err != nil {
+				return errOperationFailed
+			}
+		}
+	}
+	return nil
+}
+
+func (i *invoker) Put(context ipc.Context, profile profile.Specification) error {
+	vlog.VI(0).Infof("%v.Put(%v)", i.suffix, profile)
+	transaction := vstore.NewTransaction()
+	path := path.Join("/profiles", i.suffix)
+	if err := makeParentNodes(i.store, transaction, path); err != nil {
+		return err
+	}
+	object := i.store.Bind(path)
+	if _, err := object.Put(transaction, profile); err != nil {
+		return errOperationFailed
+	}
+	if err := transaction.Commit(); err != nil {
+		return errOperationFailed
+	}
+	return nil
+}
+
+func (i *invoker) Remove(context ipc.Context) error {
+	vlog.VI(0).Infof("%v.Remove(%v)", i.suffix)
+	transaction := vstore.NewTransaction()
+	path := path.Join("/profiles", i.suffix)
+	object := i.store.Bind(path)
+	found, err := object.Exists(transaction)
+	if err != nil {
+		return errOperationFailed
+	}
+	if !found {
+		return errNotFound
+	}
+	if err := object.Remove(transaction); err != nil {
+		return errOperationFailed
+	}
+	if err := transaction.Commit(); err != nil {
+		return errOperationFailed
+	}
+	return nil
+}
+
+// PROFILE INTERACE IMPLEMENTATION
+
+func (i *invoker) lookup() (profile.Specification, error) {
+	empty := profile.Specification{}
+	path := path.Join("/profiles", i.suffix)
+	object := i.store.Bind(path)
+	entry, err := object.Get(nil)
+	if err != nil {
+		return empty, errNotFound
+	}
+	s, ok := entry.Value.(profile.Specification)
+	if !ok {
+		return empty, errOperationFailed
+	}
+	return s, nil
+}
+
+func (i *invoker) Label(context ipc.Context) (string, error) {
+	vlog.VI(0).Infof("%v.Label()", i.suffix)
+	s, err := i.lookup()
+	if err != nil {
+		return "", err
+	}
+	return s.Label, nil
+}
+
+func (i *invoker) Description(context ipc.Context) (string, error) {
+	vlog.VI(0).Infof("%v.Description()", i.suffix)
+	s, err := i.lookup()
+	if err != nil {
+		return "", err
+	}
+	return s.Description, nil
+}
+
+func (i *invoker) Specification(context ipc.Context) (profile.Specification, error) {
+	vlog.VI(0).Infof("%v.Specification()", i.suffix)
+	return i.lookup()
+}
diff --git a/services/mgmt/profile/profile.idl b/services/mgmt/profile/profile.idl
new file mode 100644
index 0000000..88628f5
--- /dev/null
+++ b/services/mgmt/profile/profile.idl
@@ -0,0 +1,55 @@
+// Package profile contains implementation and internal interfaces and
+// types used by the implementation of Veyron profiles.
+package profile
+
+import public "veyron2/services/mgmt/profile"
+
+// Format includes a type (e.g. ELF) and each instance of the format
+// has some specific attributes. The key attributes are the target
+// operating system (e.g. for ELF this could be one of System V,
+// HP-UX, NetBSD, Linux, Solaris, AIX, IRIX, FreeBSD, and OpenBSD) and
+// the target instruction set architecture (e.g. for ELF this could be
+// one of SPARC, x86, PowerPC, ARM, IA-64, x86-64, and AArch64).
+type Format struct {
+  Name       string
+  Attributes map[string]string
+}
+
+// Library describes a shared library that applications may use.
+type Library struct {
+  // Name is the name of the library.
+  Name string
+  // MajorVersion is the major version of the library.
+  MajorVersion string
+  // MinorVersion is the minor version of the library.
+  MinorVersion string
+}
+
+// Specification is how we represent a profile internally. It should
+// provide enough information to allow matching of binaries to nodes.
+type Specification struct {
+  // Format is the file format of the application binary.
+  Format Format
+  // Libraries is a set of libraries the application binary depends on.
+  Libraries map[Library]struct{}
+  // A human-friendly concise label for the profile, e.g. "linux-media"
+  Label string
+  // A human-friendly description of the profile.
+  Description string
+}
+
+// Profile describes a profile internally. Besides the public Profile
+// interface, it allows to access and manage the actual profile
+// implementation information.
+type Profile interface {
+  public.Profile
+  // Specification returns the profile specification for the profile
+  // identified through the veyron name suffix.
+  Specification() (Specification, error)
+  // Put sets the profile specification for the profile identified
+  // through the veyron name suffix.
+  Put(Specification Specification) error
+  // Remove removes the profile specification for the profile
+  // identified through the veyron name suffix.
+  Remove() error
+}
diff --git a/services/mgmt/profile/profile.idl.go b/services/mgmt/profile/profile.idl.go
new file mode 100644
index 0000000..dceaade
--- /dev/null
+++ b/services/mgmt/profile/profile.idl.go
@@ -0,0 +1,365 @@
+// This file was auto-generated by the veyron idl tool.
+// Source: profile.idl
+
+// Package profile contains implementation and internal interfaces and
+// types used by the implementation of Veyron profiles.
+package profile
+
+import (
+	"veyron2/services/mgmt/profile"
+
+	// The non-user imports are prefixed with "_gen_" to prevent collisions.
+	_gen_idl "veyron2/idl"
+	_gen_ipc "veyron2/ipc"
+	_gen_naming "veyron2/naming"
+	_gen_rt "veyron2/rt/r"
+	_gen_wiretype "veyron2/wiretype"
+)
+
+// Format includes a type (e.g. ELF) and each instance of the format
+// has some specific attributes. The key attributes are the target
+// operating system (e.g. for ELF this could be one of System V,
+// HP-UX, NetBSD, Linux, Solaris, AIX, IRIX, FreeBSD, and OpenBSD) and
+// the target instruction set architecture (e.g. for ELF this could be
+// one of SPARC, x86, PowerPC, ARM, IA-64, x86-64, and AArch64).
+type Format struct {
+	Name       string
+	Attributes map[string]string
+}
+
+// Library describes a shared library that applications may use.
+type Library struct {
+	// Name is the name of the library.
+	Name string
+	// MajorVersion is the major version of the library.
+	MajorVersion string
+	// MinorVersion is the minor version of the library.
+	MinorVersion string
+}
+
+// Specification is how we represent a profile internally. It should
+// provide enough information to allow matching of binaries to nodes.
+type Specification struct {
+	// Format is the file format of the application binary.
+	Format Format
+	// Libraries is a set of libraries the application binary depends on.
+	Libraries map[Library]struct {
+	}
+	// A human-friendly concise label for the profile, e.g. "linux-media"
+	Label string
+	// A human-friendly description of the profile.
+	Description string
+}
+
+// Profile describes a profile internally. Besides the public Profile
+// interface, it allows to access and manage the actual profile
+// implementation information.
+// Profile is the interface the client binds and uses.
+// Profile_InternalNoTagGetter is the interface without the TagGetter
+// and UnresolveStep methods (both framework-added, rathern than user-defined),
+// to enable embedding without method collisions.  Not to be used directly by
+// clients.
+type Profile_InternalNoTagGetter interface {
+	profile.Profile_InternalNoTagGetter
+
+	// Specification returns the profile specification for the profile
+	// identified through the veyron name suffix.
+	Specification(opts ..._gen_ipc.ClientCallOpt) (reply Specification, err error)
+
+	// Put sets the profile specification for the profile identified
+	// through the veyron name suffix.
+	Put(Specification Specification, opts ..._gen_ipc.ClientCallOpt) (err error)
+
+	// Remove removes the profile specification for the profile
+	// identified through the veyron name suffix.
+	Remove(opts ..._gen_ipc.ClientCallOpt) (err error)
+}
+type Profile interface {
+	_gen_idl.TagGetter
+	// UnresolveStep returns the names for the remote service, rooted at the
+	// service's immediate namespace ancestor.
+	UnresolveStep(opts ..._gen_ipc.ClientCallOpt) ([]string, error)
+	Profile_InternalNoTagGetter
+}
+
+// ProfileService is the interface the server implements.
+type ProfileService interface {
+	profile.ProfileService
+
+	// Specification returns the profile specification for the profile
+	// identified through the veyron name suffix.
+	Specification(context _gen_ipc.Context) (reply Specification, err error)
+
+	// Put sets the profile specification for the profile identified
+	// through the veyron name suffix.
+	Put(context _gen_ipc.Context, Specification Specification) (err error)
+
+	// Remove removes the profile specification for the profile
+	// identified through the veyron name suffix.
+	Remove(context _gen_ipc.Context) (err error)
+}
+
+// BindProfile returns the client stub implementing the Profile
+// interface.
+//
+// If no _gen_ipc.Client is specified, the default _gen_ipc.Client in the
+// global Runtime is used.
+func BindProfile(name string, opts ..._gen_ipc.BindOpt) (Profile, error) {
+	var client _gen_ipc.Client
+	switch len(opts) {
+	case 0:
+		client = _gen_rt.R().Client()
+	case 1:
+		switch o := opts[0].(type) {
+		case _gen_ipc.Runtime:
+			client = o.Client()
+		case _gen_ipc.Client:
+			client = o
+		default:
+			return nil, _gen_idl.ErrUnrecognizedOption
+		}
+	default:
+		return nil, _gen_idl.ErrTooManyOptionsToBind
+	}
+	stub := &clientStubProfile{client: client, name: name}
+	stub.Profile_InternalNoTagGetter, _ = profile.BindProfile(name, client)
+
+	return stub, nil
+}
+
+// NewServerProfile creates a new server stub.
+//
+// It takes a regular server implementing the ProfileService
+// interface, and returns a new server stub.
+func NewServerProfile(server ProfileService) interface{} {
+	return &ServerStubProfile{
+		ServerStubProfile: *profile.NewServerProfile(server).(*profile.ServerStubProfile),
+		service:           server,
+	}
+}
+
+// clientStubProfile implements Profile.
+type clientStubProfile struct {
+	profile.Profile_InternalNoTagGetter
+
+	client _gen_ipc.Client
+	name   string
+}
+
+func (c *clientStubProfile) GetMethodTags(method string) []interface{} {
+	return GetProfileMethodTags(method)
+}
+
+func (__gen_c *clientStubProfile) Specification(opts ..._gen_ipc.ClientCallOpt) (reply Specification, err error) {
+	var call _gen_ipc.ClientCall
+	if call, err = __gen_c.client.StartCall(__gen_c.name, "Specification", nil, opts...); err != nil {
+		return
+	}
+	if ierr := call.Finish(&reply, &err); ierr != nil {
+		err = ierr
+	}
+	return
+}
+
+func (__gen_c *clientStubProfile) Put(Specification Specification, opts ..._gen_ipc.ClientCallOpt) (err error) {
+	var call _gen_ipc.ClientCall
+	if call, err = __gen_c.client.StartCall(__gen_c.name, "Put", []interface{}{Specification}, opts...); err != nil {
+		return
+	}
+	if ierr := call.Finish(&err); ierr != nil {
+		err = ierr
+	}
+	return
+}
+
+func (__gen_c *clientStubProfile) Remove(opts ..._gen_ipc.ClientCallOpt) (err error) {
+	var call _gen_ipc.ClientCall
+	if call, err = __gen_c.client.StartCall(__gen_c.name, "Remove", nil, opts...); err != nil {
+		return
+	}
+	if ierr := call.Finish(&err); ierr != nil {
+		err = ierr
+	}
+	return
+}
+
+func (c *clientStubProfile) UnresolveStep(opts ..._gen_ipc.ClientCallOpt) (reply []string, err error) {
+	var call _gen_ipc.ClientCall
+	if call, err = c.client.StartCall(c.name, "UnresolveStep", nil, opts...); err != nil {
+		return
+	}
+	if ierr := call.Finish(&reply, &err); ierr != nil {
+		err = ierr
+	}
+	return
+}
+
+// ServerStubProfile wraps a server that implements
+// ProfileService and provides an object that satisfies
+// the requirements of veyron2/ipc.ReflectInvoker.
+type ServerStubProfile struct {
+	profile.ServerStubProfile
+
+	service ProfileService
+}
+
+func (s *ServerStubProfile) GetMethodTags(method string) []interface{} {
+	return GetProfileMethodTags(method)
+}
+
+func (s *ServerStubProfile) Signature(call _gen_ipc.ServerCall) (_gen_ipc.ServiceSignature, error) {
+	result := _gen_ipc.ServiceSignature{Methods: make(map[string]_gen_ipc.MethodSignature)}
+	result.Methods["Put"] = _gen_ipc.MethodSignature{
+		InArgs: []_gen_ipc.MethodArgument{
+			{Name: "Specification", Type: 70},
+		},
+		OutArgs: []_gen_ipc.MethodArgument{
+			{Name: "", Type: 71},
+		},
+	}
+	result.Methods["Remove"] = _gen_ipc.MethodSignature{
+		InArgs: []_gen_ipc.MethodArgument{},
+		OutArgs: []_gen_ipc.MethodArgument{
+			{Name: "", Type: 71},
+		},
+	}
+	result.Methods["Specification"] = _gen_ipc.MethodSignature{
+		InArgs: []_gen_ipc.MethodArgument{},
+		OutArgs: []_gen_ipc.MethodArgument{
+			{Name: "", Type: 70},
+			{Name: "", Type: 71},
+		},
+	}
+
+	result.TypeDefs = []_gen_idl.AnyData{
+		_gen_wiretype.MapType{Key: 0x3, Elem: 0x3, Name: "", Tags: []string(nil)}, _gen_wiretype.StructType{
+			[]_gen_wiretype.FieldType{
+				_gen_wiretype.FieldType{Type: 0x3, Name: "Name"},
+				_gen_wiretype.FieldType{Type: 0x41, Name: "Attributes"},
+			},
+			"Format", []string(nil)},
+		_gen_wiretype.StructType{
+			[]_gen_wiretype.FieldType{
+				_gen_wiretype.FieldType{Type: 0x3, Name: "Name"},
+				_gen_wiretype.FieldType{Type: 0x3, Name: "MajorVersion"},
+				_gen_wiretype.FieldType{Type: 0x3, Name: "MinorVersion"},
+			},
+			"Library", []string(nil)},
+		_gen_wiretype.StructType{
+			nil,
+			"", []string(nil)},
+		_gen_wiretype.MapType{Key: 0x43, Elem: 0x44, Name: "", Tags: []string(nil)}, _gen_wiretype.StructType{
+			[]_gen_wiretype.FieldType{
+				_gen_wiretype.FieldType{Type: 0x42, Name: "Format"},
+				_gen_wiretype.FieldType{Type: 0x45, Name: "Libraries"},
+				_gen_wiretype.FieldType{Type: 0x3, Name: "Label"},
+				_gen_wiretype.FieldType{Type: 0x3, Name: "Description"},
+			},
+			"Specification", []string(nil)},
+		_gen_wiretype.NamedPrimitiveType{Type: 0x1, Name: "error", Tags: []string(nil)}}
+	var ss _gen_ipc.ServiceSignature
+	var firstAdded int
+	ss, _ = s.ServerStubProfile.Signature(call)
+	firstAdded = len(result.TypeDefs)
+	for k, v := range ss.Methods {
+		for i, _ := range v.InArgs {
+			if v.InArgs[i].Type >= _gen_wiretype.TypeIDFirst {
+				v.InArgs[i].Type += _gen_wiretype.TypeID(firstAdded)
+			}
+		}
+		for i, _ := range v.OutArgs {
+			if v.OutArgs[i].Type >= _gen_wiretype.TypeIDFirst {
+				v.OutArgs[i].Type += _gen_wiretype.TypeID(firstAdded)
+			}
+		}
+		if v.InStream >= _gen_wiretype.TypeIDFirst {
+			v.InStream += _gen_wiretype.TypeID(firstAdded)
+		}
+		if v.OutStream >= _gen_wiretype.TypeIDFirst {
+			v.OutStream += _gen_wiretype.TypeID(firstAdded)
+		}
+		result.Methods[k] = v
+	}
+	//TODO(bprosnitz) combine type definitions from embeded interfaces in a way that doesn't cause duplication.
+	for _, d := range ss.TypeDefs {
+		switch wt := d.(type) {
+		case _gen_wiretype.SliceType:
+			if wt.Elem >= _gen_wiretype.TypeIDFirst {
+				wt.Elem += _gen_wiretype.TypeID(firstAdded)
+			}
+			d = wt
+		case _gen_wiretype.ArrayType:
+			if wt.Elem >= _gen_wiretype.TypeIDFirst {
+				wt.Elem += _gen_wiretype.TypeID(firstAdded)
+			}
+			d = wt
+		case _gen_wiretype.MapType:
+			if wt.Key >= _gen_wiretype.TypeIDFirst {
+				wt.Key += _gen_wiretype.TypeID(firstAdded)
+			}
+			if wt.Elem >= _gen_wiretype.TypeIDFirst {
+				wt.Elem += _gen_wiretype.TypeID(firstAdded)
+			}
+			d = wt
+		case _gen_wiretype.StructType:
+			for _, fld := range wt.Fields {
+				if fld.Type >= _gen_wiretype.TypeIDFirst {
+					fld.Type += _gen_wiretype.TypeID(firstAdded)
+				}
+			}
+			d = wt
+		}
+		result.TypeDefs = append(result.TypeDefs, d)
+	}
+
+	return result, nil
+}
+
+func (s *ServerStubProfile) UnresolveStep(call _gen_ipc.ServerCall) (reply []string, err error) {
+	if unresolver, ok := s.service.(_gen_ipc.Unresolver); ok {
+		return unresolver.UnresolveStep(call)
+	}
+	if call.Server() == nil {
+		return
+	}
+	var published []string
+	if published, err = call.Server().Published(); err != nil || published == nil {
+		return
+	}
+	reply = make([]string, len(published))
+	for i, p := range published {
+		reply[i] = _gen_naming.Join(p, call.Name())
+	}
+	return
+}
+
+func (__gen_s *ServerStubProfile) Specification(call _gen_ipc.ServerCall) (reply Specification, err error) {
+	reply, err = __gen_s.service.Specification(call)
+	return
+}
+
+func (__gen_s *ServerStubProfile) Put(call _gen_ipc.ServerCall, Specification Specification) (err error) {
+	err = __gen_s.service.Put(call, Specification)
+	return
+}
+
+func (__gen_s *ServerStubProfile) Remove(call _gen_ipc.ServerCall) (err error) {
+	err = __gen_s.service.Remove(call)
+	return
+}
+
+func GetProfileMethodTags(method string) []interface{} {
+	if resp := profile.GetProfileMethodTags(method); resp != nil {
+		return resp
+	}
+	switch method {
+	case "Specification":
+		return []interface{}{}
+	case "Put":
+		return []interface{}{}
+	case "Remove":
+		return []interface{}{}
+	default:
+		return nil
+	}
+}
diff --git a/services/mgmt/profile/profiled/main.go b/services/mgmt/profile/profiled/main.go
new file mode 100644
index 0000000..0162f5f
--- /dev/null
+++ b/services/mgmt/profile/profiled/main.go
@@ -0,0 +1,48 @@
+package main
+
+import (
+	"flag"
+
+	"veyron/lib/signals"
+	"veyron/services/mgmt/profile/impl"
+
+	"veyron2/rt"
+	"veyron2/vlog"
+)
+
+func main() {
+	var storeName string
+	flag.StringVar(&storeName, "store", "", "veyron name of the profile manager store")
+	flag.Parse()
+	if storeName == "" {
+		vlog.Fatalf("Specify a store using --store=<name>")
+	}
+	runtime := rt.Init()
+	defer runtime.Shutdown()
+	server, err := runtime.NewServer()
+	if err != nil {
+		vlog.Fatalf("NewServer() failed: %v", err)
+	}
+	defer server.Stop()
+	dispatcher, err := impl.NewDispatcher(storeName)
+	if err != nil {
+		vlog.Fatalf("NewDispatcher() failed: %v", err)
+	}
+	suffix := ""
+	if err := server.Register(suffix, dispatcher); err != nil {
+		vlog.Fatalf("Register(%v, %v) failed: %v", suffix, dispatcher, err)
+	}
+	protocol, hostname := "tcp", "localhost:0"
+	endpoint, err := server.Listen(protocol, hostname)
+	if err != nil {
+		vlog.Fatalf("Listen(%v, %v) failed: %v", protocol, hostname, err)
+	}
+	name := ""
+	if err := server.Publish(name); err != nil {
+		vlog.Fatalf("Publish(%v) failed: %v", name, err)
+	}
+	vlog.VI(0).Infof("Profile manager published at %v/%v", endpoint, name)
+
+	// Wait until shutdown.
+	<-signals.ShutdownOnSignals()
+}