7 Inherits Ice
.Application
9 Public Overrides
Function run(ByVal args
As String()) As Integer
10 ' Terminate cleanly on receipt of a signal
14 ' Create an object adapter (stored in the _adapter
17 Dim adapter
As Ice
.ObjectAdapter
= communicator().createObjectAdapterWithEndpoints( _
18 "SimpleFilesystem", "default -h 127.0.0.1 -p 10000")
19 DirectoryI
._adapter
= adapter
20 FileI
._adapter
= adapter
22 ' Create the root directory (with name "/" and no parent)
24 Dim root
As DirectoryI
= New DirectoryI("/", Nothing)
26 ' Create a file called "README" in the root directory
28 Dim file
As FileI
= New FileI("README", root
)
29 Dim text
As String() = New String() {"This file system contains a collection of poetry."}
32 Catch e
As GenericError
33 Console
.Error.WriteLine(e
.reason
)
36 ' Create a directory called "Coleridge"
37 ' in the root directory
39 Dim coleridge
As DirectoryI
= New DirectoryI("Coleridge", root
)
41 ' Create a file called "Kubla_Khan"
42 ' in the Coleridge directory
44 file
= New FileI("Kubla_Khan", coleridge
)
45 text
= New String() {"In Xanadu did Kubla Khan", _
46 "A stately pleasure-dome decree:", _
47 "Where Alph, the sacred river, ran", _
48 "Through caverns measureless to man", _
49 "Down to a sunless sea."}
51 CType(file
, FileOperationsNC_
).write(text
)
53 Catch e
As GenericError
54 Console
.Error.WriteLine(e
.reason
)
57 ' All objects are created, allow client requests now
61 ' Wait until we are done
63 communicator().waitForShutdown()
66 Console
.Error.WriteLine(appName() & ": terminating")
74 Public Sub Main(ByVal args
As String())
75 Dim app
As Server
= New Server
76 Environment
.Exit(app
.Main(args
))