from net.sourceforge.plantuml import SourceStringReader
from java.io import ByteArrayOutputStream
from net.sourceforge.plantuml import FileFormatOption,FileFormat
from java.lang import String
from java.io import FileOutputStream

source = """
@startuml

scale 600*400

[AA] <<static lib>>
[BB] <<shared lib>>
[CC] <<static lib>>

node node1
node node2 <<shared node>>
database Production

skinparam component {
            backgroundColor<<static lib>> DarkKhaki
                backgroundColor<<shared lib>> Green
                }

skinparam node {
            borderColor Green
                backgroundColor Yellow
                    backgroundColor<<shared node>> Magenta
                    }
skinparam databaseBackgroundColor Aqua

@enduml
"""

s=SourceStringReader(source)

file =FileOutputStream("diagram.png")
s.generateImage(file);
print "diagram.png created"
file.close()

