summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorspaunov <spaunov@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2005-05-21 21:36:05 +0000
committerspaunov <spaunov@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2005-05-21 21:36:05 +0000
commiteb2fbde0fdabea8d4363874cc2a300518fb86166 (patch)
tree85de65eeacd00edaa6943aa4327fe5dabc7c286b
parent6f5da7aa5aea631ea3e566d7114e4588d0927052 (diff)
downloadATCD-eb2fbde0fdabea8d4363874cc2a300518fb86166.tar.gz
Sat May 21 17:17:58 EDT 2005Stoyan Paunov <s.paunov@vanderbilt.edu>
-rw-r--r--TAO/CIAO/DAnCE/ciao/Deployment.idl54
-rw-r--r--TAO/CIAO/DAnCE/new_RepositoryManager/Modified_Deployment.xsd688
-rw-r--r--TAO/CIAO/DAnCE/new_RepositoryManager/Options.cpp86
-rw-r--r--TAO/CIAO/DAnCE/new_RepositoryManager/Options.h75
-rw-r--r--TAO/CIAO/DAnCE/new_RepositoryManager/README.txt6
-rw-r--r--TAO/CIAO/DAnCE/new_RepositoryManager/RMadmin.cpp229
-rw-r--r--TAO/CIAO/DAnCE/new_RepositoryManager/RepositoryManager.cpp79
-rw-r--r--TAO/CIAO/DAnCE/new_RepositoryManager/ZIP_Wrapper.cpp233
-rw-r--r--TAO/CIAO/DAnCE/new_RepositoryManager/ZIP_Wrapper.h74
-rw-r--r--TAO/CIAO/DAnCE/new_RepositoryManager/new_RepositoryManager.idl13
-rw-r--r--TAO/CIAO/DAnCE/new_RepositoryManager/new_RepositoryManager.mpc52
-rw-r--r--TAO/CIAO/DAnCE/new_RepositoryManager/new_RepositoryManager.suo1
-rw-r--r--TAO/CIAO/DAnCE/new_RepositoryManager/new_RepositoryManager_Impl.cpp497
-rw-r--r--TAO/CIAO/DAnCE/new_RepositoryManager/new_RepositoryManager_Impl.h207
-rw-r--r--TAO/CIAO/DAnCE/new_RepositoryManager/packages/inconsistent.cpkbin0 -> 436 bytes
-rw-r--r--TAO/CIAO/DAnCE/new_RepositoryManager/packages/package.cpkbin0 -> 26 bytes
16 files changed, 2294 insertions, 0 deletions
diff --git a/TAO/CIAO/DAnCE/ciao/Deployment.idl b/TAO/CIAO/DAnCE/ciao/Deployment.idl
index 386593b3628..4bb894acf76 100644
--- a/TAO/CIAO/DAnCE/ciao/Deployment.idl
+++ b/TAO/CIAO/DAnCE/ciao/Deployment.idl
@@ -119,4 +119,58 @@ module Deployment {
raises (NoSuchName);
};
+
+//***************************************new_RepositoryManager ONWARDS*****************************************
+
+
+ typedef sequence<octet> Artifact;
+ typedef sequence<octet> Package;
+
+ enum Platform {
+ Win32,
+ Unix,
+ Linux,
+ Solaris,
+ Vxworks,
+ UNDEF
+ };
+
+ struct Implementation
+ {
+ Platform the_platform;
+ string name;
+ Artifact the_implementation;
+ };
+
+ typedef sequence<Implementation> Implementations;
+
+ interface new_RepositoryManager
+ {
+ void installPackage (in string installationName, in Package the_package, in boolean replace)
+ raises (NameExists, PackageError);
+
+ DeploymentPlan retrievePlan (in string packageName);
+
+ Package findPackageByName (in string name)
+ raises (NoSuchName);
+
+ Implementation findImplementationByName (in string implementation_name, in string package_name)
+ raises (NoSuchName);
+
+ Package findPackageByUUID (in string UUID)
+ raises (NoSuchName);
+
+ Implementation findImplementationByUUID (in string UUID)
+ raises (NoSuchName);
+
+
+ //::CORBA::StringSeq findNamesByType (in string type);
+ //::CORBA::StringSeq getAllTypes ();
+
+ ::CORBA::StringSeq getAllPackageNames ();
+
+ void deletePackage (in string installationName)
+ raises (NoSuchName);
+ };
+
};
diff --git a/TAO/CIAO/DAnCE/new_RepositoryManager/Modified_Deployment.xsd b/TAO/CIAO/DAnCE/new_RepositoryManager/Modified_Deployment.xsd
new file mode 100644
index 00000000000..53ff11a9107
--- /dev/null
+++ b/TAO/CIAO/DAnCE/new_RepositoryManager/Modified_Deployment.xsd
@@ -0,0 +1,688 @@
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.w3.org/2001/XMLSchema XMLSchema.xsd" xmlns:Deployment="http://www.omg.org/Deployment"
+ targetNamespace="http://www.omg.org/Deployment">
+ <xsd:simpleType name="TCKind">
+ <xsd:restriction base="xsd:NCName">
+ <xsd:enumeration value="tk_null" />
+ <xsd:enumeration value="tk_void" />
+ <xsd:enumeration value="tk_short" />
+ <xsd:enumeration value="tk_long" />
+ <xsd:enumeration value="tk_ushort" />
+ <xsd:enumeration value="tk_ulong" />
+ <xsd:enumeration value="tk_float" />
+ <xsd:enumeration value="tk_double" />
+ <xsd:enumeration value="tk_boolean" />
+ <xsd:enumeration value="tk_char" />
+ <xsd:enumeration value="tk_octet" />
+ <xsd:enumeration value="tk_any" />
+ <xsd:enumeration value="tk_TypeCode" />
+ <xsd:enumeration value="tk_Principal" />
+ <xsd:enumeration value="tk_objref" />
+ <xsd:enumeration value="tk_struct" />
+ <xsd:enumeration value="tk_union" />
+ <xsd:enumeration value="tk_enum" />
+ <xsd:enumeration value="tk_string" />
+ <xsd:enumeration value="tk_sequence" />
+ <xsd:enumeration value="tk_array" />
+ <xsd:enumeration value="tk_alias" />
+ <xsd:enumeration value="tk_except" />
+ <xsd:enumeration value="tk_longlong" />
+ <xsd:enumeration value="tk_ulonglong" />
+ <xsd:enumeration value="tk_longdouble" />
+ <xsd:enumeration value="tk_wchar" />
+ <xsd:enumeration value="tk_wstring" />
+ <xsd:enumeration value="tk_wfixed" />
+ <xsd:enumeration value="tk_value" />
+ <xsd:enumeration value="tk_value_box" />
+ <xsd:enumeration value="tk_native" />
+ <xsd:enumeration value="tk_abstract_interface" />
+ <xsd:enumeration value="tk_local_interface" />
+ <xsd:enumeration value="tk_component" />
+ <xsd:enumeration value="tk_home" />
+ <xsd:enumeration value="tk_event" />
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="DataType">
+ <xsd:choice>
+ <xsd:element name="kind" type="Deployment:TCKind" />
+ <!--
+@@ not used, what for?
+
+ <xsd:element name="enum" type="Deployment:EnumType"/>
+ <xsd:element name="objref" type="Deployment:ObjrefType"/>
+ <xsd:element name="boundedString" type="Deployment:BoundedStringType"/>
+ <xsd:element name="fixed" type="Deployment:FixedType"/>
+ <xsd:element name="array" type="Deployment:ArrayType"/>
+ <xsd:element name="sequence" type="Deployment:SequenceType"/>
+ <xsd:element name="alias" type="Deployment:AliasType"/>
+ <xsd:element name="struct" type="Deployment:StructType"/>
+ <xsd:element name="value" type="Deployment:ValueType"/>
+ <xsd:element name="union" type="Deployment:UnionType"/>
+-->
+ </xsd:choice>
+ </xsd:complexType>
+ <xsd:complexType name="DataValue">
+ <xsd:choice>
+ <xsd:element name="short" type="xsd:short" />
+ <xsd:element name="long" type="xsd:int" />
+ <xsd:element name="ushort" type="xsd:unsignedShort" />
+ <xsd:element name="ulong" type="xsd:unsignedInt" />
+ <xsd:element name="float" type="xsd:float" />
+ <xsd:element name="double" type="xsd:double" />
+ <xsd:element name="boolean" type="xsd:boolean" />
+ <xsd:element name="octet" type="xsd:unsignedByte" />
+ <!-- xsd:element name="opaque" type="xsd:base64Binary"/ -->
+ <xsd:element name="objref" type="xsd:string" />
+ <xsd:element name="enum" type="xsd:string" />
+ <xsd:element name="string" type="xsd:string" />
+ <xsd:element name="longlong" type="xsd:long" />
+ <xsd:element name="ulonglong" type="xsd:unsignedLong" />
+ <xsd:element name="longdouble" type="xsd:double" />
+ <xsd:element name="fixed" type="xsd:string" />
+ <!--
+@@ recursive
+ <xsd:element name="any" type="Deployment:Any"/>
+-->
+ <xsd:element name="typecode" type="Deployment:DataType" />
+ <!--
+@@ recursive
+ <xsd:element name="element" type="Deployment:DataValue"/>
+ <xsd:element name="discriminator" type="Deployment:DataValue"/>
+ <xsd:element name="value" type="Deployment:DataValue"/>
+ <xsd:element name="boxedValue" type="Deployment:DataValue"/>
+ <xsd:element name="member" type="Deployment:NamedValue"/>
+-->
+ </xsd:choice>
+ </xsd:complexType>
+ <xsd:complexType name="Any">
+ <xsd:sequence>
+ <xsd:element name="type" type="Deployment:DataType" />
+ <xsd:element name="value" type="Deployment:DataValue" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="Property">
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string" />
+ <xsd:element name="value" type="Deployment:Any" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <!-- End of base definitions. -->
+ <xsd:complexType name="Node">
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string" />
+ <xsd:element name="label" type="xsd:string" />
+ <!--
+@@ recursive, not used
+ <xsd:element name="connection" type="Deployment:Interconnect"/>
+ <xsd:element name="sharedResource" type="Deployment:SharedResource"/>
+ <xsd:element name="resource" type="Deployment:Resource"/>
+-->
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:simpleType name="SatisfierPropertyKind">
+ <xsd:restriction base="xsd:NCName">
+ <xsd:enumeration value="Quantity" />
+ <xsd:enumeration value="Capacity" />
+ <xsd:enumeration value="Minimum" />
+ <xsd:enumeration value="Maximum" />
+ <xsd:enumeration value="Attribute" />
+ <xsd:enumeration value="Selection" />
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="SatisfierProperty">
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string" />
+ <xsd:element name="kind" type="Deployment:SatisfierPropertyKind" />
+ <xsd:element name="value" type="Deployment:Any" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="Resource">
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string" />
+ <xsd:element name="resourceType" type="xsd:string" />
+ <xsd:element name="property" type="Deployment:SatisfierProperty" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="SharedResource">
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string" />
+ <xsd:element name="resourceType" type="xsd:string" />
+ <xsd:element name="node" type="Deployment:Node" />
+ <xsd:element name="property" type="Deployment:SatisfierProperty" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="Domain">
+ <xsd:sequence>
+ <xsd:element name="label" type="xsd:string" />
+ <xsd:element name="UUID" type="xsd:string" />
+ <xsd:element name="sharedResource" type="Deployment:SharedResource" minOccurs="0" />
+ <xsd:element name="node" type="Deployment:Node" maxOccurs="unbounded" />
+ <!--
+@@ recursive, not used
+ <xsd:element name="interconnect" type="Deployment:Interconnect"/>
+ <xsd:element name="bridge" type="Deployment:Bridge"/>
+-->
+ <xsd:element name="infoProperty" type="Deployment:Property" minOccurs="0" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="Requirement">
+ <xsd:sequence>
+ <xsd:element name="resourceType" type="xsd:string" />
+ <xsd:element name="name" type="xsd:string" />
+ <xsd:element name="property" type="Deployment:Property" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <!-- Deployment -->
+ <xsd:complexType name="ResourceDeploymentDescription">
+ <xsd:sequence>
+ <xsd:element name="requirementName" type="xsd:string" />
+ <xsd:element name="resourceName" type="xsd:string" />
+ <xsd:element name="resourceValue" type="Deployment:Any" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="ArtifactDeploymentDescription">
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string" />
+ <xsd:element name="source" type="xsd:string" />
+ <xsd:element name="node" type="xsd:string" minOccurs="0" />
+ <xsd:element name="location" type="xsd:string" maxOccurs="unbounded" />
+ <xsd:element name="execParameter" type="Deployment:Property" minOccurs="0" />
+ <xsd:element name="deployRequirement" type="Deployment:Requirement" minOccurs="0" />
+ <xsd:element name="deployedResource" type="Deployment:ResourceDeploymentDescription" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID" />
+ </xsd:complexType>
+ <xsd:complexType name="MonolithicDeploymentDescription">
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string" />
+ <xsd:element name="source" type="xsd:string" />
+ <xsd:element name="artifact" type="xsd:IDREF" maxOccurs="unbounded" />
+ <!-- ArtifactDeploymentDescription -->
+ <xsd:element name="execParameter" type="Deployment:Property" minOccurs="0" />
+ <xsd:element name="deployRequirement" type="Deployment:Requirement" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID" />
+ </xsd:complexType>
+ <xsd:simpleType name="ResourceUsageKind">
+ <xsd:restriction base="xsd:NCName">
+ <xsd:enumeration value="None" />
+ <xsd:enumeration value="InstanceUsesResource" />
+ <xsd:enumeration value="ResourceUsesInstance" />
+ <xsd:enumeration value="PortUsesResource" />
+ <xsd:enumeration value="ResourceUsesPort" />
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="InstanceResourceDeploymentDescription">
+ <xsd:sequence>
+ <xsd:element name="resourceUsage" type="Deployment:ResourceUsageKind" />
+ <xsd:element name="requirementName" type="xsd:string" />
+ <xsd:element name="resourceName" type="xsd:string" />
+ <xsd:element name="resourceValue" type="Deployment:Any" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="InstanceDeploymentDescription">
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string" />
+ <xsd:element name="node" type="xsd:string" />
+ <xsd:element name="source" type="xsd:string" />
+ <xsd:element name="implementation" type="xsd:IDREF" />
+ <!-- MonolithicDeploymentDescription -->
+ <xsd:element name="configProperty" type="Deployment:Property" minOccurs="0" />
+ <xsd:element name="deployedResource" type="Deployment:InstanceResourceDeploymentDescription"
+ minOccurs="0" />
+ <xsd:element name="deployedSharedResource" type="Deployment:InstanceResourceDeploymentDescription"
+ minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID" />
+ </xsd:complexType>
+ <xsd:simpleType name="CCMComponentPortKind">
+ <xsd:restriction base="xsd:NCName">
+ <xsd:enumeration value="Facet" />
+ <xsd:enumeration value="SimplexReceptacle" />
+ <xsd:enumeration value="MultiplexReceptacle" />
+ <xsd:enumeration value="EventEmitter" />
+ <xsd:enumeration value="EventPublisher" />
+ <xsd:enumeration value="EventConsumer" />
+ </xsd:restriction>
+ </xsd:simpleType>
+ <xsd:complexType name="ComponentPortDescription">
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string" />
+ <xsd:element name="specificType" type="xsd:string" />
+ <xsd:element name="supportedType" type="xsd:string" />
+ <xsd:element name="provider" type="xsd:string" />
+ <xsd:element name="exclusiveProvider" type="xsd:string" />
+ <xsd:element name="exclusiveUser" type="xsd:string" />
+ <xsd:element name="optional" type="xsd:string" />
+ <xsd:element name="kind" type="Deployment:CCMComponentPortKind" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="ComponentPropertyDescription">
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string" />
+ <xsd:element name="type" type="Deployment:DataType" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="ComponentInterfaceDescription">
+ <xsd:choice>
+ <xsd:sequence>
+ <xsd:element name="label" type="xsd:string" />
+ <xsd:element name="UUID" type="xsd:string" />
+ <xsd:element name="specificType" type="xsd:string" />
+ <xsd:element name="supportedType" type="xsd:string" maxOccurs="unbounded" />
+ <xsd:element name="idlFile" type="xsd:string" minOccurs="0" />
+ <xsd:element name="configProperty" type="Deployment:Property" minOccurs="0" />
+ <xsd:element name="port" type="Deployment:ComponentPortDescription" maxOccurs="unbounded" />
+ <xsd:element name="property" type="Deployment:ComponentPropertyDescription" minOccurs="0" />
+ <xsd:element name="infoProperty" type="Deployment:Property" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:element name="contentLocation" type="xsd:string" />
+ </xsd:choice>
+ </xsd:complexType>
+ <xsd:complexType name="ComponentExternalPortEndpoint">
+ <xsd:sequence>
+ <xsd:element name="portName" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="PlanSubcomponentPortEndpoint">
+ <xsd:sequence>
+ <xsd:element name="portName" type="xsd:string" />
+ <xsd:element name="provider" type="xsd:string" minOccurs="0" />
+ <xsd:element name="kind" type="Deployment:CCMComponentPortKind" />
+ <xsd:element name="instance" type="xsd:IDREF" />
+ <!-- InstanceDeploymentDescription -->
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="ExternalReferenceEndpoint">
+ <xsd:sequence>
+ <xsd:element name="location" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="ConnectionResourceDeploymentDescription">
+ <xsd:sequence>
+ <xsd:element name="targetName" type="xsd:string" />
+ <xsd:element name="requirementName" type="xsd:string" />
+ <xsd:element name="resourceName" type="xsd:string" />
+ <xsd:element name="resourceValue" type="Deployment:Any" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="PlanConnectionDescription">
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string" />
+ <xsd:element name="source" type="xsd:string" minOccurs="0" />
+ <xsd:element name="deployRequirement" type="Deployment:Requirement" minOccurs="0" />
+ <xsd:element name="externalEndpoint" type="Deployment:ComponentExternalPortEndpoint" minOccurs="0"
+ maxOccurs="unbounded" />
+ <xsd:element name="internalEndpoint" type="Deployment:PlanSubcomponentPortEndpoint" minOccurs="0"
+ maxOccurs="unbounded" />
+ <xsd:element name="externalReference" type="Deployment:ExternalReferenceEndpoint" minOccurs="0"
+ maxOccurs="unbounded" />
+ <xsd:element name="deployedResource" type="Deployment:ConnectionResourceDeploymentDescription"
+ minOccurs="0" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="ImplementationDependency">
+ <xsd:sequence>
+ <xsd:element name="requiredType" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="DeploymentPlan">
+ <xsd:sequence>
+ <xsd:element name="label" type="xsd:string" minOccurs="0" />
+ <xsd:element name="UUID" type="xsd:string" minOccurs="0" />
+ <xsd:element name="realizes" type="Deployment:ComponentInterfaceDescription" />
+ <xsd:element name="implementation" type="Deployment:MonolithicDeploymentDescription" maxOccurs="unbounded" />
+ <xsd:element name="instance" type="Deployment:InstanceDeploymentDescription" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="connection" type="Deployment:PlanConnectionDescription" minOccurs="0" maxOccurs="unbounded" />
+ <!-- potentially recursive, not used
+ <xsd:element name="externalProperty" type="Deployment:PlanPropertyMapping"/>
+ -->
+ <xsd:element name="dependsOn" type="Deployment:ImplementationDependency" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="artifact" type="Deployment:ArtifactDeploymentDescription" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="infoProperty" type="Deployment:Property" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <!-- Implementation -->
+ <xsd:complexType name="Capability">
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string" />
+ <xsd:element name="resourceType" type="xsd:string" />
+ <xsd:element name="property" type="Deployment:SatisfierProperty" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="NamedImplementationArtifact">
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string" />
+ <!-- @@ recursive NIA->IAD->NIA -->
+ <xsd:element name="referencedArtifact" type="Deployment:ImplementationArtifactDescription" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="ImplementationArtifactDescription">
+ <xsd:choice>
+ <xsd:sequence>
+ <xsd:element name="label" type="xsd:string" />
+ <xsd:element name="UUID" type="xsd:string" />
+ <!-- @@ There probably should be only one location? -->
+ <xsd:element name="location" type="xsd:string" maxOccurs="unbounded" />
+ <xsd:element name="execParameter" type="Deployment:Property" minOccurs="0" />
+ <xsd:element name="deployRequirement" type="Deployment:Requirement" minOccurs="0" />
+ <xsd:element name="dependsOn" type="Deployment:NamedImplementationArtifact" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element name="infoProperty" type="Deployment:Property" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:element name="contentLocation" type="xsd:string" />
+ </xsd:choice>
+ </xsd:complexType>
+ <xsd:complexType name="ImplementationRequirement">
+ <xsd:sequence>
+ <xsd:element name="resourceUsage" type="Deployment:ResourceUsageKind" />
+ <xsd:element name="resourcePort" type="xsd:string" />
+ <xsd:element name="componentPort" type="xsd:string" />
+ <xsd:element name="resourceType" type="xsd:string" />
+ <xsd:element name="name" type="xsd:string" />
+ <xsd:element name="property" type="Deployment:Property" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="MonolithicImplementationDescription">
+ <xsd:sequence>
+ <xsd:element name="execParameter" type="Deployment:Property" minOccurs="0" />
+ <xsd:element name="primaryArtifact" type="Deployment:NamedImplementationArtifact" maxOccurs="unbounded" />
+ <xsd:element name="deployRequirement" type="Deployment:ImplementationRequirement" minOccurs="0" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="PackagedComponentImplementation">
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string" />
+ <!-- @@ recursive CPD->PCI->CID->CAD->SID->CPD -->
+ <xsd:element name="referencedImplementation" type="Deployment:ComponentImplementationDescription" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="ComponentPackageDescription">
+ <xsd:choice>
+ <xsd:sequence>
+ <xsd:element name="label" type="xsd:string" />
+ <xsd:element name="UUID" type="xsd:string" />
+ <xsd:element name="realizes" type="Deployment:ComponentInterfaceDescription" minOccurs="0" />
+ <xsd:element name="configProperty" type="Deployment:Property" minOccurs="0" />
+ <xsd:element name="implementation" type="Deployment:PackagedComponentImplementation" />
+ <xsd:element name="infoProperty" type="Deployment:Property" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:element name="contentLocation" type="xsd:string" />
+ </xsd:choice>
+ </xsd:complexType>
+ <xsd:complexType name="ComponentPackageReference">
+ <xsd:sequence>
+ <xsd:element name="requiredUUID" type="xsd:string" />
+ <xsd:element name="requiredName" type="xsd:string" />
+ <xsd:element name="requiredType" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="SubcomponentInstantiationDescription">
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string" />
+ <xsd:element name="package" type="Deployment:ComponentPackageDescription" />
+ <xsd:element name="configProperty" type="Deployment:Property" minOccurs="0" />
+ <xsd:element name="selectRequirement" type="Deployment:Requirement" minOccurs="0" />
+ <xsd:element name="reference" type="Deployment:ComponentPackageReference" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="id" type="xsd:ID" />
+ </xsd:complexType>
+ <xsd:complexType name="SubcomponentPortEndpoint">
+ <xsd:sequence>
+ <xsd:element name="portName" type="xsd:string" />
+ <xsd:element name="instance" type="xsd:IDREF" />
+ <!-- SubcomponentInstantiationDescription -->
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="AssemblyConnectionDescription">
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string" />
+ <xsd:element name="deployRequirement" type="Deployment:Requirement" minOccurs="0" />
+ <xsd:element name="externalEndpoint" type="Deployment:ComponentExternalPortEndpoint" minOccurs="0"
+ maxOccurs="unbounded" />
+ <xsd:element name="internalEndpoint" type="Deployment:SubcomponentPortEndpoint" minOccurs="0"
+ maxOccurs="unbounded" />
+ <xsd:element name="externalReference" type="Deployment:ExternalReferenceEndpoint" minOccurs="0"
+ maxOccurs="unbounded" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="SubcomponentPropertyReference">
+ <xsd:sequence>
+ <xsd:element name="propertyName" type="xsd:string" />
+ <xsd:element name="instance" type="Deployment:SubcomponentInstantiationDescription" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="AssemblyPropertyMapping">
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string" />
+ <xsd:element name="externalName" type="xsd:string" />
+ <xsd:element name="delegatesTo" type="Deployment:SubcomponentPropertyReference" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="ComponentAssemblyDescription">
+ <xsd:sequence>
+ <xsd:element name="instance" type="Deployment:SubcomponentInstantiationDescription" maxOccurs="unbounded" />
+ <xsd:element name="connection" type="Deployment:AssemblyConnectionDescription" maxOccurs="unbounded" />
+ <xsd:element name="externalProperty" type="Deployment:AssemblyPropertyMapping" minOccurs="0" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="ComponentImplementationDescription">
+ <xsd:choice>
+ <xsd:sequence>
+ <xsd:element name="label" type="xsd:string" />
+ <xsd:element name="UUID" type="xsd:string" />
+ <xsd:element name="implements" type="Deployment:ComponentInterfaceDescription" minOccurs="0" />
+ <xsd:choice>
+ <xsd:element name="assemblyImpl" type="Deployment:ComponentAssemblyDescription" />
+ <xsd:element name="monolithicImpl" type="Deployment:MonolithicImplementationDescription" />
+ </xsd:choice>
+ <xsd:element name="configProperty" type="Deployment:Property" minOccurs="0" />
+ <xsd:element name="capability" type="Deployment:Capability" minOccurs="0" />
+ <xsd:element name="dependsOn" type="Deployment:ImplementationDependency" minOccurs="0" />
+ <xsd:element name="infoProperty" type="Deployment:Property" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:element name="contentLocation" type="xsd:string" />
+ </xsd:choice>
+ </xsd:complexType>
+ <!-- Package -->
+ <xsd:complexType name="PackageConfiguration">
+ <xsd:choice>
+ <xsd:sequence>
+ <xsd:element name="label" type="xsd:string" />
+ <xsd:element name="UUID" type="xsd:string" />
+ <!--
+@@ recursive, not used
+ <xsd:element name="specializedConfig" type="Deployment:PackageConfiguration"/>
+-->
+ <xsd:element name="basePackage" type="Deployment:ComponentPackageDescription" />
+ <xsd:element name="reference" type="Deployment:ComponentPackageReference" minOccurs="0" />
+ <xsd:element name="selectRequirement" type="Deployment:Requirement" minOccurs="0" />
+ <xsd:element name="configProperty" type="Deployment:Property" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:element name="contentLocation" type="xsd:string" />
+ </xsd:choice>
+ </xsd:complexType>
+ <xsd:complexType name="TopLevelPackageDescription">
+ <xsd:sequence>
+ <xsd:element name="package" type="Deployment:PackageConfiguration" maxOccurs="unbounded" />
+ </xsd:sequence>
+ </xsd:complexType>
+ <!-- Top-level elements. -->
+ <xsd:element name="domain" type="Deployment:Domain" />
+ <xsd:element name="deploymentPlan" type="Deployment:DeploymentPlan" />
+ <xsd:element name="implementationArtifactDescription" type="Deployment:ImplementationArtifactDescription" />
+ <xsd:element name="componentInterfaceDescription" type="Deployment:ComponentInterfaceDescription" />
+ <xsd:element name="componentImplementationDescription" type="Deployment:ComponentImplementationDescription" />
+ <xsd:element name="componentPackageDescription" type="Deployment:ComponentPackageDescription" />
+ <xsd:element name="packageConfiguration" type="Deployment:PackageConfiguration" />
+ <xsd:element name="topLevelPackageDescription" type="Deployment:TopLevelPackageDescription" />
+ <!-- VAULT
+
+Place for strange things. Nobody knows what they are for...
+
+-->
+ <!--
+
+ <xsd:complexType name="EnumType">
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string"/>
+ <xsd:element name="typeId" type="xsd:string"/>
+ <xsd:element name="member" type="xsd:string" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="ObjrefType">
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string"/>
+ <xsd:element name="typeId" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+
+ <xsd:complexType name="BoundedStringType">
+ <xsd:choice minOccurs="0" maxOccurs="unbounded">
+ <xsd:element name="bound" type="xsd:string"/>
+ </xsd:choice>
+ </xsd:complexType>
+
+
+ <xsd:complexType name="FixedType">
+ <xsd:choice minOccurs="0" maxOccurs="unbounded">
+ <xsd:element name="digits" type="xsd:string"/>
+ <xsd:element name="scale" type="xsd:string"/>
+ </xsd:choice>
+ </xsd:complexType>
+
+
+ <xsd:complexType name="ArrayType">
+ <xsd:choice minOccurs="0" maxOccurs="unbounded">
+ <xsd:element name="length" type="xsd:string"/>
+ <xsd:element name="elementType" type="Deployment:DataType"/>
+ </xsd:choice>
+ </xsd:complexType>
+
+ <xsd:complexType name="SequenceType">
+ <xsd:choice minOccurs="0" maxOccurs="unbounded">
+ <xsd:element name="bound" type="xsd:string"/>
+ <xsd:element name="elementType" type="Deployment:DataType"/>
+ </xsd:choice>
+ </xsd:complexType>
+
+ <xsd:complexType name="AliasType">
+ <xsd:choice minOccurs="0" maxOccurs="unbounded">
+ <xsd:element name="name" type="xsd:string"/>
+ <xsd:element name="typeId" type="xsd:string"/>
+ <xsd:element name="elementType" type="Deployment:DataType"/>
+ </xsd:choice>
+ </xsd:complexType>
+
+ <xsd:complexType name="StructType">
+ <xsd:choice minOccurs="0" maxOccurs="unbounded">
+ <xsd:element name="name" type="xsd:string"/>
+ <xsd:element name="typeId" type="xsd:string"/>
+ <xsd:element name="member" type="Deployment:StructMemberType"/>
+ </xsd:choice>
+ </xsd:complexType>
+
+ <xsd:complexType name="StructMemberType">
+ <xsd:choice minOccurs="0" maxOccurs="unbounded">
+ <xsd:element name="name" type="xsd:string"/>
+ <xsd:element name="type" type="Deployment:DataType"/>
+ </xsd:choice>
+ </xsd:complexType>
+
+ <xsd:complexType name="ValueType">
+ <xsd:choice minOccurs="0" maxOccurs="unbounded">
+ <xsd:element name="name" type="xsd:string"/>
+ <xsd:element name="typeId" type="xsd:string"/>
+ <xsd:element name="modifier" type="xsd:string"/>
+ <xsd:element name="baseType" type="Deployment:DataType"/>
+ <xsd:element name="member" type="Deployment:ValueMemberType"/>
+ </xsd:choice>
+ </xsd:complexType>
+
+ <xsd:complexType name="ValueMemberType">
+ <xsd:choice minOccurs="0" maxOccurs="unbounded">
+ <xsd:element name="name" type="xsd:string"/>
+ <xsd:element name="visibility" type="xsd:string"/>
+ <xsd:element name="type" type="Deployment:DataType"/>
+ </xsd:choice>
+ </xsd:complexType>
+
+ <xsd:complexType name="UnionType">
+ <xsd:choice minOccurs="0" maxOccurs="unbounded">
+ <xsd:element name="name" type="xsd:string"/>
+ <xsd:element name="typeId" type="xsd:string"/>
+ <xsd:element name="default" type="Deployment:UnionMemberType"/>
+ <xsd:element name="discriminatorType" type="Deployment:DataType"/>
+ <xsd:element name="member" type="Deployment:UnionMemberType"/>
+ </xsd:choice>
+ </xsd:complexType>
+
+ <xsd:complexType name="UnionMemberType">
+ <xsd:choice minOccurs="0" maxOccurs="unbounded">
+ <xsd:element name="name" type="xsd:string"/>
+ <xsd:element name="type" type="Deployment:DataType"/>
+ <xsd:element name="label" type="Deployment:DataValue"/>
+ </xsd:choice>
+ </xsd:complexType>
+
+
+ <xsd:complexType name="NamedValue">
+ <xsd:choice minOccurs="0" maxOccurs="unbounded">
+ <xsd:element name="name" type="xsd:string"/>
+ <xsd:element name="value" type="Deployment:DataValue"/>
+ </xsd:choice>
+ </xsd:complexType>
+
+
+ <xsd:complexType name="Bridge">
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string"/>
+ <xsd:element name="label" type="xsd:string"/>
+ <xsd:element name="connect" type="Deployment:Interconnect"/>
+ <xsd:element name="resource" type="Deployment:Resource"/>
+ </xsd:sequence>
+ </xsd:complexType>
+
+ <xsd:complexType name="Interconnect">
+ <xsd:choice minOccurs="0" maxOccurs="unbounded">
+ <xsd:element name="name" type="xsd:string"/>
+ <xsd:element name="label" type="xsd:string"/>
+ <xsd:element name="connection" type="Deployment:Bridge"/>
+ <xsd:element name="connect" type="Deployment:Node"/>
+ <xsd:element name="resource" type="Deployment:Resource"/>
+ </xsd:choice>
+ </xsd:complexType>
+
+ <xsd:complexType name="PlanPropertyMapping">
+ <xsd:choice minOccurs="0" maxOccurs="unbounded">
+ <xsd:element name="name" type="xsd:string"/>
+ <xsd:element name="source" type="xsd:string"/>
+ <xsd:element name="externalName" type="xsd:string"/>
+ <xsd:element name="delegatesTo" type="Deployment:PlanSubcomponentPropertyReference"/>
+ </xsd:choice>
+ </xsd:complexType>
+
+
+ <xsd:complexType name="PlanSubcomponentPropertyReference">
+ <xsd:choice minOccurs="0" maxOccurs="unbounded">
+ <xsd:element name="propertyName" type="xsd:string"/>
+ <xsd:element name="instance" type="Deployment:InstanceDeploymentDescription"/>
+ </xsd:choice>
+ </xsd:complexType>
+
+-->
+ <!--
+
+ This type is not referenced anywhere.
+
+ <xsd:complexType name="RequirementSatisfier">
+ <xsd:choice minOccurs="0" maxOccurs="unbounded">
+ <xsd:element name="name" type="xsd:string"/>
+ <xsd:element name="resourceType" type="xsd:string"/>
+ <xsd:element name="property" type="Deployment:SatisfierProperty"/>
+ </xsd:choice>
+ </xsd:complexType>
+
+-->
+</xsd:schema> \ No newline at end of file
diff --git a/TAO/CIAO/DAnCE/new_RepositoryManager/Options.cpp b/TAO/CIAO/DAnCE/new_RepositoryManager/Options.cpp
new file mode 100644
index 00000000000..40985d0cb30
--- /dev/null
+++ b/TAO/CIAO/DAnCE/new_RepositoryManager/Options.cpp
@@ -0,0 +1,86 @@
+// $Id$
+
+// Options.cpp,v Stoyan
+
+#include "ace/Get_Opt.h"
+#include "ace/ARGV.h"
+#include "Options.h"
+
+Options *Options::instance_ = 0;
+
+Options *
+Options::instance (void)
+{
+
+ if (Options::instance_ == 0)
+ Options::instance_ = new Options;
+
+ return Options::instance_;
+}
+
+void
+Options::parse_args (int argc, ACE_TCHAR *argv[])
+{
+ ACE_Get_Opt get_opt (argc, argv, ACE_TEXT ("n:l:a:idps"));
+
+ int c;
+
+ while ((c = get_opt ()) != -1)
+ switch (c)
+ {
+ case 'i':
+ this->install_ = true;
+ break;
+ case 'd':
+ this->delete_ = true;
+ break;
+ case 'p':
+ this->plan_ = true;
+ break;
+ case 's':
+ this->shutdown_ = true;
+ break;
+ case 'n':
+ this->package_ = get_opt.opt_arg ();
+ break;
+ case 'l':
+ this->local_path_ = get_opt.opt_arg ();
+ break;
+ case 'a':
+ this->artifact_ = get_opt.opt_arg ();
+ break;
+ // Usage fallthrough.
+ default:
+ this->usage ();
+
+ }
+
+ if ((this->package_ == "") && (this->shutdown_ == false))
+ this->usage ();
+ if (this->package_ != "")
+ {
+ if (!(this->install_ || this->plan_ || this->delete_ || (this->artifact_ != "")))
+ this->usage ();
+ else if (this->install_ && this->local_path_ == "")
+ this->usage ();
+ }
+}
+
+void Options::usage (void)
+{
+ ACE_DEBUG ((LM_DEBUG, "OPTIONS: -s <shutdown> -n <:package> [-i <install> -l <:local_path>] \
+ [-d <delete>] [-p <plan>] [-a <artifact>]\n"));
+ ACE_OS::exit (1);
+}
+
+
+Options::Options (void)
+ : package_ (""),
+ local_path_ (""),
+ artifact_ (""),
+ delete_ (false),
+ install_ (false),
+ plan_ (false),
+ shutdown_ (false)
+{
+}
diff --git a/TAO/CIAO/DAnCE/new_RepositoryManager/Options.h b/TAO/CIAO/DAnCE/new_RepositoryManager/Options.h
new file mode 100644
index 00000000000..0b6acf62d76
--- /dev/null
+++ b/TAO/CIAO/DAnCE/new_RepositoryManager/Options.h
@@ -0,0 +1,75 @@
+// $Id$
+
+/* -*- C++ -*- */
+// Options.h, Stoyan
+
+//============================================================================
+//
+// = LIBRARY
+// JAWS
+//
+// = FILENAME
+// Options.h
+//
+// = DESCRIPTION
+// Options is an Singleton for blobby
+//
+// = AUTHOR
+// Stoyan Paunov
+//
+//============================================================================
+
+#ifndef HTTP_OPTIONS_H
+#define HTTP_OPTIONS_H
+
+#include "ace/Get_Opt.h"
+#include "ace/String_Base.h"
+#include "ace/OS_NS_string.h" //for ACE_CString
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/ARGV.h"
+
+class Options
+{
+public:
+ static Options *instance (void);
+ // Returns the singleton instance
+
+ void parse_args (int argc, ACE_TCHAR *argv[]);
+ // parses commandline arguments
+
+ ACE_CString package_;
+ // Name of package
+
+ ACE_CString local_path_;
+ // specifies the local path for install
+
+ ACE_CString artifact_;
+ // Implementation Artifact requested
+
+ bool delete_;
+ // delete the package_ name
+
+ bool install_;
+ // installs the package_ name
+
+ bool plan_;
+ // retrieves the DeploymentPlan specified in the package_ name
+
+ bool shutdown_;
+ //shutdown the RepositoryManagerDemon
+
+protected:
+ Options (void);
+ // protected constructor, singleton
+
+ static Options *instance_;
+ // the singleton
+
+ void usage (void);
+};
+
+#endif /* HTTP_OPTIONS_H */
diff --git a/TAO/CIAO/DAnCE/new_RepositoryManager/README.txt b/TAO/CIAO/DAnCE/new_RepositoryManager/README.txt
new file mode 100644
index 00000000000..b9f0fcbf883
--- /dev/null
+++ b/TAO/CIAO/DAnCE/new_RepositoryManager/README.txt
@@ -0,0 +1,6 @@
+to compile with tao_idl use:
+
+tao_idl -GI new_RepositoryManager.idl -I%TAO_ROOT% -I%TAO_ROOT%\tao -I%TAO_ROOT%\orbsvcs -I%CIAO_ROOT%\DAnCE\ciao
+
+
+
diff --git a/TAO/CIAO/DAnCE/new_RepositoryManager/RMadmin.cpp b/TAO/CIAO/DAnCE/new_RepositoryManager/RMadmin.cpp
new file mode 100644
index 00000000000..d7a758176da
--- /dev/null
+++ b/TAO/CIAO/DAnCE/new_RepositoryManager/RMadmin.cpp
@@ -0,0 +1,229 @@
+// $Id$
+
+/**
+ * @file RMClient.cpp
+ *
+ * @auther Stoyan <s.paunov@vanderbilt.edu
+ */
+
+#include "new_RepositoryManagerC.h"
+#include "Options.h"
+
+#include "ace/OS_NS_fcntl.h" //for open
+#include "ace/OS_NS_unistd.h" //for close
+#include "ace/OS_NS_sys_stat.h" //for filesize and fstat and mkdir
+
+#include "Config_Handlers/DnC_Dump.h"
+
+#include <iostream>
+using namespace std;
+
+//IOR file of the Sender
+const char * ior = "file://RepositoryManagerDeamon.ior";
+
+
+//=============================COUPLE OF HELPER METHORS==================================
+CORBA::Octet* read_from_disk (
+ const char* full_path,
+ size_t &length
+ );
+
+int write_to_disk (
+ const char* full_path,
+ const CORBA::Octet* buffer,
+ size_t length
+ );
+//========================================================================================
+
+
+
+int
+ACE_TMAIN (int argc, ACE_TCHAR *argv[])
+{
+ ACE_TRY_NEW_ENV
+ {
+ // Initialize orb
+ CORBA::ORB_var orb = CORBA::ORB_init (argc,
+ argv,
+ ""
+ ACE_ENV_ARG_PARAMETER);
+
+ ACE_TRY_CHECK;
+
+
+ CORBA::Object_var obj =
+ orb->string_to_object (ior
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ CIAO::new_RepositoryManagerDaemon_var rm =
+ CIAO::new_RepositoryManagerDaemon::_narrow (obj.in ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (CORBA::is_nil (rm.in ()))
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Unable to acquire new_RepositoryManagerDaemon's objref\n"),
+ -1);
+ }
+
+
+ Options* options = Options::instance ();
+ options->parse_args (argc, argv);
+
+ if (options->shutdown_)
+ {
+ rm->shutdown ();
+ }
+ else if (options->install_)
+ {
+ size_t length = 0;
+ CORBA::Octet* buffer = read_from_disk (options->local_path_.c_str (), length);
+
+ Deployment::Package* the_package = new Deployment::Package (
+ length, //max of the sequence
+ length, //length of the sequence
+ buffer, //data to be stored within the sequence
+ true //take ownership of the data
+ );
+
+ try
+ {
+ rm->installPackage (options->package_.c_str (), *the_package, false);
+ }
+ catch (CORBA::Exception &ex)
+ {
+ cout << "\nPackage is already in the repository!\n";
+ }
+
+ cout << "\nReassuring that the package in the repository ..." << endl;
+ try
+ {
+ Deployment::Package_var package_back = rm->findPackageByName (options->package_.c_str ());
+ cout << "The package was found!" << endl;
+ cout << "Its size is " << package_back->length () << endl;
+ }
+ catch (CORBA::Exception &ex)
+ {
+ cout << "\nNo such package!" << endl;
+ }
+ }
+ else if (options->delete_)
+ {
+ try
+ {
+ rm->deletePackage (options->package_.c_str ());
+ cout << options->package_.c_str () << " deleted" << endl;
+ }
+ catch (CORBA::Exception &ex)
+ {
+ cout << "\nNo such package!" << endl;
+ }
+
+ }
+ else if (options->plan_)
+ {
+
+ Deployment::DeploymentPlan_var plan = rm->retrievePlan (options->package_.c_str ());
+
+ Deployment::DnC_Dump::dump (plan);
+ }
+ else if (options->artifact_ != "")
+ {
+ try
+ {
+ Deployment::Implementation_var impl = rm->findImplementationByName (options->artifact_.c_str (),
+ options->package_.c_str());
+ write_to_disk (impl->name, impl->the_implementation.get_buffer (),impl->the_implementation.length ());
+ }
+ catch (CORBA::Exception &ex)
+ {
+ cout << "\nNo such implementation artifact in that package!" << endl;
+ }
+
+ }
+
+
+ orb->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "Unknown exception \n");
+ return -1;
+ }
+ ACE_ENDTRY;
+
+ return 0;
+}
+
+
+
+CORBA::Octet* read_from_disk (
+ const char* full_path,
+ size_t &length
+ )
+{
+ //open the file
+
+ ACE_HANDLE handle = ACE_OS::open (full_path, O_RDONLY);
+ if (handle == ACE_INVALID_HANDLE)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("%p\n"),
+ ACE_TEXT ("[RM::read_from_disk] file open error")),
+ 0);
+
+ ACE_stat file_info;
+
+ ACE_OS::fstat (handle, &file_info);
+
+ CORBA::Octet* buffer = new CORBA::Octet[file_info.st_size];
+
+ if (buffer == 0)
+ return 0;
+
+ //read the contents of the file into the buffer
+ if (ACE_OS::read_n (handle, buffer, file_info.st_size) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("%p\n"),
+ ACE_TEXT ("[RM::write_to_disk] file write error")),
+ 0);
+
+ // Close the file handle
+ ACE_OS::close (handle);
+
+ length = file_info.st_size;
+ return buffer;
+}
+
+
+int write_to_disk (
+ const char* full_path,
+ const CORBA::Octet* buffer,
+ size_t length
+ )
+{
+
+ // Open a file handle to the local filesystem
+ ACE_HANDLE handle = ACE_OS::open (full_path, _O_CREAT | _O_TRUNC | O_WRONLY);
+ if (handle == ACE_INVALID_HANDLE)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("%p\n"),
+ ACE_TEXT ("[RM::write_to_disk] file creation error")),
+ -1);
+
+ //write the data to the file
+ if (ACE_OS::write (handle, buffer, length) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("%p\n"),
+ ACE_TEXT ("[RM::write_to_disk] file write error")),
+ -1);
+
+ // Close the file handle
+ ACE_OS::close (handle);
+
+ return 1;
+}
+
diff --git a/TAO/CIAO/DAnCE/new_RepositoryManager/RepositoryManager.cpp b/TAO/CIAO/DAnCE/new_RepositoryManager/RepositoryManager.cpp
new file mode 100644
index 00000000000..400c3ba1f53
--- /dev/null
+++ b/TAO/CIAO/DAnCE/new_RepositoryManager/RepositoryManager.cpp
@@ -0,0 +1,79 @@
+// $Id$
+
+//RepositoryManager.cpp, v2.0 Stoyan
+
+#include "new_RepositoryManager_Impl.h"
+#include "ace/OS_NS_stdio.h"
+#include "ace/streams.h"
+#include "ace/Auto_Ptr.h"
+using namespace std;
+
+const char * rm_ior = "RepositoryManagerDeamon.ior";
+
+
+int
+ACE_TMAIN (int argc, ACE_TCHAR *argv[])
+{
+
+ //check the previous implementation for stuff to reuse!
+
+ try
+ {
+ //init the ORB
+ CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
+
+ //Get the root POA object
+ CORBA::Object_var obj = orb->resolve_initial_references ("RootPOA");
+
+ //downcast to POA type
+ PortableServer::POA_var root_poa = PortableServer::POA::_narrow (obj.in ());
+
+ //activate the POA manager
+ PortableServer::POAManager_var mgr = root_poa->the_POAManager ();
+ mgr->activate ();
+
+ //create a servant
+ CIAO_new_RepositoryManagerDaemon_i* repo = new CIAO_new_RepositoryManagerDaemon_i (orb.in ());
+
+ //trasfer ownership to the POA
+ PortableServer::ServantBase_var distributor_owner_transfer(repo);
+
+ //register servant
+ CIAO::new_RepositoryManagerDaemon_var RepositoryManagerDeamon = repo->_this ();
+
+ //convert the IOR to string
+ CORBA::String_var ior = orb->object_to_string (RepositoryManagerDeamon.in ());
+
+ //output the IOR to a file
+ FILE* ior_out = ACE_OS::fopen (rm_ior, "w");
+
+ if (ior_out == 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Cannot open output file for writing IOR: %s",
+ rm_ior),
+ 1);
+
+ ACE_OS::fprintf (ior_out, "%s", ior.in ());
+ ACE_OS::fclose (ior_out);
+
+ //Start accepting requests
+ orb->run ();
+
+ //allow objects registered with the POA ot get cleaned-up
+ root_poa->destroy (1, 1);
+
+ //shutdown the orb
+ orb->shutdown (1);
+
+ return 0;
+ }
+ catch (CORBA::Exception &ex) {
+ cerr << "CORBA Exception: " << ex << endl;
+
+ return 1;
+ }
+
+
+ return 0;
+}
+
diff --git a/TAO/CIAO/DAnCE/new_RepositoryManager/ZIP_Wrapper.cpp b/TAO/CIAO/DAnCE/new_RepositoryManager/ZIP_Wrapper.cpp
new file mode 100644
index 00000000000..61c1a21fe7c
--- /dev/null
+++ b/TAO/CIAO/DAnCE/new_RepositoryManager/ZIP_Wrapper.cpp
@@ -0,0 +1,233 @@
+// $Id$
+
+#include "ace/Containers_T.h" //for ACE_Double_Linked_List
+#include "ace/Message_Block.h" //for ACE_Message_Block
+
+#include "ace/OS_NS_fcntl.h" //for open
+#include "ace/OS_NS_unistd.h" //for close
+#include "ace/OS_NS_sys_stat.h" //for filesize and mkdir
+
+#include <string>
+#include <memory> //for auto_ptr
+
+
+/////////////////////////////////////////////////////////////////////////////
+//NOTE: some #defines problems with zzip & ACE - put these 2 lines on top!!!!
+/////////////////////////////////////////////////////////////////////////////
+#include "zziplib.h" //for ZZIP
+#include "ZIP_Wrapper.h"
+
+
+//ZIP_File_Info constructor
+ZIP_File_Info::ZIP_File_Info (char* name, size_t size)
+ : name_ (name),
+ size_ (size),
+ next_ (0),
+ prev_ (0)
+{
+}
+
+//ZIP_File_Info default constructor
+ZIP_File_Info::ZIP_File_Info ()
+ : name_ (""),
+ size_ (0),
+ next_ (0),
+ prev_ (0)
+{
+}
+
+
+//get a list of the files in the archive
+size_t ZIP_Wrapper::file_list_info (char* zip_name, ACE_Double_Linked_List<ZIP_File_Info> &list)
+{
+ size_t num = 0; //number of files in archive
+ ZZIP_DIR * dir; //pointer to a zip archive
+ ZZIP_DIRENT * dir_entry; //pointer to a file within the archive
+
+ //open the zip archive
+ dir = zzip_opendir(zip_name);
+
+ if (!dir)
+ return false;
+
+ //read each dir entry and show one line of info per file
+ while (dir_entry = zzip_readdir (dir))
+ {
+ //retrieve the name of the file
+ char* name = dir_entry->d_name;
+
+ //remove the subpath part if any NOTE: Lunux style assumed, need to check
+ //while(char* next = strstr(name, "/"))
+ // name = next + 1;
+
+ list.insert_tail (new ZIP_File_Info (name, dir_entry->st_size));
+ }
+
+ zzip_closedir(dir);
+ return 0;
+}
+
+//get file and store it into an ACE_Message_Block
+bool ZIP_Wrapper::get_file (char* accessor, ACE_Message_Block &file)
+{
+ bool return_code = true;
+
+ ZZIP_FILE* zip_file = zzip_open (accessor, O_RDONLY|O_BINARY);
+
+ if (! zip_file)
+ return false;
+
+ int num_read;
+ file.size(BUFSIZ);
+ ACE_Message_Block* head = &file;
+
+ // read chunks of 16 bytes into buf and print them to stdout
+ while (0 < (num_read = zzip_read(zip_file, head->wr_ptr(), head->size())))
+ {
+ head->wr_ptr (num_read);
+ head->cont (new ACE_Message_Block (BUFSIZ));
+ head = head->cont ();
+ }
+
+ if (num_read == -1)
+ return_code = false;
+
+ zzip_file_close (zip_file);
+
+ return return_code;
+}
+
+
+bool ZIP_Wrapper::get_file (char* archive_path, char* filename, ACE_Message_Block &file)
+{
+ bool return_code = true;
+ ZZIP_DIR * dir; //pointer to a zip archive
+
+ //open the zip archive
+ dir = zzip_opendir(archive_path);
+
+ if (!dir)
+ return false;
+
+ //get the handle to the file
+ ZZIP_FILE* zip_file = zzip_file_open (dir, filename, O_RDONLY|O_BINARY);
+
+ if (!zip_file)
+ return false;
+
+ int num_read;
+ file.size(BUFSIZ);
+ ACE_Message_Block* head = &file;
+
+ //read the file into the ACE_Message_Block
+ while (0 < (num_read = zzip_read(zip_file, head->wr_ptr(), head->size())))
+ {
+ head->wr_ptr (num_read);
+ head->cont (new ACE_Message_Block (BUFSIZ));
+ head = head->cont ();
+ }
+
+ if (num_read == -1)
+ return_code = false;
+
+ zzip_file_close (zip_file);
+ zzip_closedir(dir);
+
+ return return_code;
+}
+
+
+//uncompress
+//the uncompress format will be
+//mkdir(name of zip archive)
+//store all files in that directory.
+//the path is assumed to be an existing directory
+bool ZIP_Wrapper::uncompress (char* zip_archive, char* path)
+{
+ ZZIP_DIR * dir; //pointer to a zip archive
+ ZZIP_DIRENT * dir_entry; //pointer to a file within the archive
+ ZZIP_FILE* file; //pointer to a zip file within an archive
+
+ //open the zip archive
+ dir = zzip_opendir(zip_archive);
+
+ if (!dir)
+ return false;
+
+ //??????
+ //check if a directory with the name if the archive exists
+ //If not, create it. Else, existing files will be truncated upon open.
+ //??????
+
+ //get the name of the archive
+ std::string arch_dir (path);
+ arch_dir += "/";
+ arch_dir += zip_archive;
+ arch_dir[arch_dir.length () - 4] = '\0'; //NOTE: Assumes .zip extension
+
+ //create directory
+ ACE_OS::mkdir(arch_dir.c_str()); //if dir exists -1 is returned and ignored
+
+ //read each dir entry and show one line of info per file
+ while (dir_entry = zzip_readdir (dir))
+ {
+ //retrieve the name of the file
+ char* name = dir_entry->d_name;
+
+ //remove the subpath part if any NOTE: Lunux style assumed, need to check
+ while(char* next = strstr(name, "/"))
+ name = next + 1;
+
+ //open a zip handle
+ file = zzip_file_open(dir, dir_entry->d_name, O_RDONLY|O_BINARY);
+ if (!file)
+ return false;
+
+ //allocate buffer
+
+ //TODO: change to ACE_NEW_RETURN
+ std::auto_ptr<char> buffer;
+ buffer.reset ( new char [dir_entry->st_size + 1]);
+
+ //read in the data
+ zzip_read(file, &(*buffer), dir_entry->st_size);
+
+ //close the zip handle
+ zzip_file_close (file);
+
+ //create file name + path to open
+ std::string file_path (arch_dir.c_str ()); //NOTE: need the c-style char to stop at '\0'
+ file_path += "/";
+ file_path += name;
+
+ //print out the file to be uncompressed
+ ACE_OS::write(ACE_STDOUT, file_path.c_str (), file_path.length () );
+ ACE_OS::write(ACE_STDOUT, "\n", 1);
+
+ // Open a file handle to the local filesystem
+ ACE_HANDLE handle = ACE_OS::open (file_path.c_str (), _O_CREAT | _O_TRUNC | O_WRONLY);
+ if (handle == ACE_INVALID_HANDLE)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("%p\n"),
+ ACE_TEXT ("[uncompress] file creation error")),
+ 0);
+
+ //write the uncompressed data to the file
+ if (ACE_OS::write (handle, &(*buffer), dir_entry->st_size) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("%p\n"),
+ ACE_TEXT ("[uncompress] file write error")),
+ 0);
+
+ // Close the file handle
+ ACE_OS::close (handle);
+
+ //free buffer
+ //TODO: check if auto_ptr has a fxn to release the memory before scope is exited
+ //delete [] buffer;
+
+ }
+
+ zzip_closedir(dir);
+ return true;
+}
diff --git a/TAO/CIAO/DAnCE/new_RepositoryManager/ZIP_Wrapper.h b/TAO/CIAO/DAnCE/new_RepositoryManager/ZIP_Wrapper.h
new file mode 100644
index 00000000000..a85e4ebde7b
--- /dev/null
+++ b/TAO/CIAO/DAnCE/new_RepositoryManager/ZIP_Wrapper.h
@@ -0,0 +1,74 @@
+// $Id$
+
+///====================================================================
+//@filename: ZIP_Wrapper.h
+//@Author: Stoyan Paunov spaunov@isis.vanderbilt.edu
+//
+//@Purpose: to provide a wrapper around ZZIPlib for easy handling of
+// ZIP archives. This wrapper can me used as an auxiliary
+// class that allows a program to become ZIP-aware
+
+
+#ifndef _ZIP_WRAPPER_H_
+#define _ZIP_WRAPPER_H_
+
+#include "ace/Containers_T.h" //for ACE_Double_Linked_List
+#include "ace/Message_Block.h" //for ACE_Message_Block
+
+#include "ace/OS_NS_fcntl.h" //for open
+#include "ace/OS_NS_sys_stat.h" //for filesize and mkdir
+
+#include <string>
+
+///===================================================================
+//Class definition for ZIP_File_Info
+//
+//@Description: This class is used as a carrier of information
+// about entities residing inside a ZIP archive
+
+class ZIP_File_Info
+{
+public:
+ std::string name_;
+ size_t size_;
+ ZIP_File_Info* next_;
+ ZIP_File_Info* prev_;
+
+ ZIP_File_Info (char* name, size_t size);
+ ZIP_File_Info ();
+};
+
+
+///===================================================================
+//Class definition for ZIP_Wrapper
+//
+//@Description: This class is the actual workhorse that provides all of
+// the necessary functionality
+
+class ZIP_Wrapper
+{
+
+public:
+
+ //get a list of the files in the archive
+ size_t file_list_info (char* zip_name, ACE_Double_Linked_List<ZIP_File_Info> &list);
+
+ //get file and store it into an ACE_Message_Block
+ //need to provide the correct accessor string. It formed by the ZIP_Options
+ //singleton on argument parsing and stored in ZIP_Options::instance()->read_file_
+ //ACE_Message_Block is null-terminated, but this is not reflected in the size!
+ bool get_file (char* accessor, ACE_Message_Block &file);
+
+ //additional get_file function to avert subdirectory traversal problems with
+ //zziplib accessors
+ bool get_file (char* archive_path, char* filename, ACE_Message_Block &file);
+
+ //uncompress
+ //the uncompress format will be
+ //mkdir(name of zip archive)
+ //store all files in that directory.
+ //the path is assumed to be an existing directory
+ bool uncompress (char* zip_archive, char* path = "");
+};
+
+#endif
diff --git a/TAO/CIAO/DAnCE/new_RepositoryManager/new_RepositoryManager.idl b/TAO/CIAO/DAnCE/new_RepositoryManager/new_RepositoryManager.idl
new file mode 100644
index 00000000000..8ae7e4d9167
--- /dev/null
+++ b/TAO/CIAO/DAnCE/new_RepositoryManager/new_RepositoryManager.idl
@@ -0,0 +1,13 @@
+// $Id$
+
+#include "Deployment.idl"
+
+module CIAO
+{
+ interface new_RepositoryManagerDaemon : Deployment::new_RepositoryManager
+ {
+ // Shutdown the daemon process.
+ oneway void shutdown ();
+ };
+};
+
diff --git a/TAO/CIAO/DAnCE/new_RepositoryManager/new_RepositoryManager.mpc b/TAO/CIAO/DAnCE/new_RepositoryManager/new_RepositoryManager.mpc
new file mode 100644
index 00000000000..de872f8b4cb
--- /dev/null
+++ b/TAO/CIAO/DAnCE/new_RepositoryManager/new_RepositoryManager.mpc
@@ -0,0 +1,52 @@
+// $Id$
+
+
+project (new_RepositoryManager) : ciao_server_dnc,ciao_deployment_svnt, ciao_deployment_stub, taoexe, xerces, exceptions {
+
+ exename = RepositoryManagerDeamon
+ after += XSC_Config_Handlers
+ libs += XSC_Config_Handlers
+ libs += CIAO_DnC_Server
+
+ includes += $(ZZIP_ROOT)/zziplib $(ZLIB_ROOT)
+ libpaths += $(ZLIB_ROOT)/lib $(ZZIP_ROOT)/lib
+ libs += zlib zziplib
+
+ //requires += zlib
+ //lit_libs += zlib //stupid MPC does not add ZLIB by default, only its wrapper ZZIP ?!?!?!
+ //requires += zzip
+
+ IDL_Files {
+ new_RepositoryManager.idl
+ }
+
+ Source_Files {
+ new_RepositoryManagerC.cpp
+ new_RepositoryManagerS.cpp
+ ZIP_Wrapper.cpp
+ RepositoryManager.cpp
+ new_RepositoryManager_Impl.cpp
+ }
+}
+
+
+// -*- MPC -*-
+// RMadmin.mpc v1.0 Stoyan
+
+project (RMAdmin) : ciao_client_dnc, ciao_deployment_stub, exceptions {
+ exename = RMadmin
+ after += new_RepositoryManager
+ after += XSC_Config_Handlers
+ libs += XSC_Config_Handlers
+ libs += CIAO_DnC_Client
+
+
+ IDL_Files {
+ }
+
+ Source_Files {
+ RMadmin.cpp
+ new_RepositoryManagerC.cpp
+ Options.cpp
+ }
+}
diff --git a/TAO/CIAO/DAnCE/new_RepositoryManager/new_RepositoryManager.suo b/TAO/CIAO/DAnCE/new_RepositoryManager/new_RepositoryManager.suo
new file mode 100644
index 00000000000..3599f1b0124
--- /dev/null
+++ b/TAO/CIAO/DAnCE/new_RepositoryManager/new_RepositoryManager.suo
@@ -0,0 +1 @@
+ÐÏࡱ \ No newline at end of file
diff --git a/TAO/CIAO/DAnCE/new_RepositoryManager/new_RepositoryManager_Impl.cpp b/TAO/CIAO/DAnCE/new_RepositoryManager/new_RepositoryManager_Impl.cpp
new file mode 100644
index 00000000000..47ec43b3972
--- /dev/null
+++ b/TAO/CIAO/DAnCE/new_RepositoryManager/new_RepositoryManager_Impl.cpp
@@ -0,0 +1,497 @@
+// $Id$
+
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// .\be\be_codegen.cpp:939
+
+#include "new_RepositoryManager_Impl.h"
+
+#include "ace/OS_NS_fcntl.h" //for open
+#include "ace/OS_NS_unistd.h" //for close
+#include "ace/OS_NS_sys_stat.h" //for filesize and fstat and mkdir
+#include "ace/OS_NS_string.h" //for ACE_CString
+
+
+//to remove a file or dir from the local filesystem need remove () from stdio.h
+// ---> need to include ace/OS_NS_stdio.h which would include the correct file for any OS!
+#include "ace/OS_NS_stdio.h"
+
+#include "ZIP_Wrapper.h"
+#include "ace/Containers_T.h" //for ACE_Double_Linked_List
+#include "ace/Malloc_Allocator.h" //for ACE_New_Allocator needed by the doubly link list
+
+#include "Config_Handlers/cdp.hpp"
+#include "Config_Handlers/Deployment.hpp"
+#include "Config_Handlers/DP_Handler.h"
+#include "ciao/Deployment_DataC.h"
+#include "Config_Handlers/XML_Helper.h"
+
+#include "ace/Thread.h" //for obtaining the ID of the current thread
+#include "ace/OS_NS_stdlib.h" //for itoa ()
+
+
+#include <iostream>
+using namespace std;
+
+
+// Implementation skeleton constructor
+CIAO_new_RepositoryManagerDaemon_i::CIAO_new_RepositoryManagerDaemon_i (CORBA::ORB_ptr the_orb)
+: the_orb_ (CORBA::ORB::_duplicate (the_orb))
+{
+ //create directory in which the packages will be stored
+
+ ACE_OS::mkdir(RM_STORAGE_PATH);
+ //if dir already exists a -1 is returned
+ //we ignore this, just need to make sure the directory exists
+}
+
+// Implementation skeleton destructor
+CIAO_new_RepositoryManagerDaemon_i::~CIAO_new_RepositoryManagerDaemon_i (void)
+{
+ this->packages_.unbind_all ();
+}
+
+void CIAO_new_RepositoryManagerDaemon_i::shutdown (
+
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ // Add your implementation here
+
+ this->packages_.unbind_all ();
+
+ this->the_orb_->shutdown (1);
+
+ ACE_OS::exit (0);
+}
+
+void CIAO_new_RepositoryManagerDaemon_i::installPackage (
+ const char * installationName,
+ const ::Deployment::Package & the_package,
+ ::CORBA::Boolean replace
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ ::Deployment::NameExists,
+ ::Deployment::PackageError
+ ))
+{
+ // Add your implementation here
+
+ ACE_Hash_Map_Entry <ACE_CString, ACE_CString> *entry;
+
+ if (this->packages_.find (ACE_CString (installationName), entry) == 0)
+ ACE_THROW (Deployment::NameExists ());
+
+ ACE_CString path (RM_STORAGE_PATH);
+ path += "/";
+ path += installationName;
+ path += ".cpk";
+
+ int retn_code = this->write_to_disk (path.c_str (), the_package.get_buffer (), the_package.length ());
+
+ if (retn_code == -1)
+ ACE_THROW (Deployment::PackageError ());
+
+ //insert the package into the database
+ this->packages_.bind (ACE_CString (installationName), path);
+}
+
+::Deployment::DeploymentPlan * CIAO_new_RepositoryManagerDaemon_i::retrievePlan (
+ const char * packageName
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ // Add your implementation here
+
+ cout << "in retrieve Plan!" << endl;
+
+ //form the path to the archive in the local filesystem
+ ACE_CString path (RM_STORAGE_PATH);
+ path += "/";
+ path += packageName;
+ path += ".cpk";
+
+ //create a ZIP wrapper
+ ZIP_Wrapper zip;
+
+ //create a doubly link list
+ ACE_New_Allocator allocator;
+ ACE_Double_Linked_List<ZIP_File_Info> list (&allocator);
+
+
+ cout << "Getting the list ..." <<endl;
+
+ //get the list of files in the package and figure out the name of the Deployment Plan
+ zip.file_list_info (const_cast<char*> (path.c_str ()), list);
+ ACE_CString plan_name;
+ CORBA::Boolean found = false;
+
+ while (!list.is_empty ())
+ {
+ ZIP_File_Info* inf = list.delete_head ();
+ if (!found && ACE_OS::strstr (inf->name_.c_str (), ".cdp"))
+ {
+ cout << inf->name_.c_str () << endl;
+ plan_name = inf->name_.c_str ();
+ found = true;
+ }
+ delete inf;
+ }
+
+ //there is not deployment plan in the package
+ if (!found)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("%p\n"),
+ ACE_TEXT ("[RM::retrievePlan] no DeploymentPlan in package!\n")),
+ 0);
+
+ //read the Deployment plan from the package
+ ACE_Message_Block file (0,0);
+ if (!zip.get_file( const_cast<char*> (path.c_str ()), const_cast<char*> (plan_name.c_str ()), file))
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("%p\n"),
+ ACE_TEXT ("[RM::retrievePlan] Unable to retrieve file!\n")),
+ 0);
+
+
+ //if file is 0 length XERCESC Fails!!!
+
+ //We are using Xercesc in the Config_Handlers and unfortunately its API only
+ //takes a file in the local file system as an argument, thus need to
+ //write out the contents of the deployent plan to a file
+ //in the current directory. I use the thread id to guarrantee
+ //lack of race conditions if multithreading is enabled
+ unsigned int thread_id = ACE_Thread::self ();
+ char temp[128];
+
+ ACE_CString local_file ("_dp_temp_");
+ local_file += ACE_OS::itoa (thread_id, temp, 10);
+
+ //write the file to disk
+ if(!this->write_to_disk (const_cast<char*> (local_file.c_str ()), file))
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("%p\n"),
+ ACE_TEXT ("[RM::retrievePlan] DeploymentPlan preparation failule!\n")),
+ 0);
+
+ //parse the Deployment plan and return the resulting data structure
+ CIAO::Config_Handlers::XML_Helper the_helper;
+ xercesc::DOMDocument *doc;
+
+ if (!(doc = the_helper.create_dom (local_file.c_str ())))
+ return 0;
+
+ CIAO::Config_Handlers::DeploymentPlan dp = CIAO::Config_Handlers::deploymentPlan (doc);
+ CIAO::Config_Handlers::DP_Handler dp_handler (dp);
+
+ //we no longer need the file with the deployment plan, so lets erase it!
+ remove (local_file.c_str ());
+
+ //the non-const version of this function releases the ownership of the plan
+ //before it returns it so we are safe to return the return value
+ return dp_handler.plan ();
+}
+
+::Deployment::Package * CIAO_new_RepositoryManagerDaemon_i::findPackageByName (
+ const char * name
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ ::Deployment::NoSuchName
+ ))
+{
+ // Add your implementation here
+
+ // Find out if the package was installed in the repository,
+ // return it if found or throw and exception otherwise
+
+ ACE_Hash_Map_Entry <ACE_CString, ACE_CString> *entry = 0;
+
+ if (this->packages_.find (ACE_CString (name), entry) != 0)
+ ACE_THROW (Deployment::NoSuchName ()); // package not found
+
+
+ size_t length = 0;
+ CORBA::Octet* buffer = this->read_from_disk (entry->int_id_.c_str (), length);
+
+ Deployment::Package* package = new Deployment::Package (
+ length, //max of the sequence
+ length, //length of the sequence
+ buffer, //data to be stored within the sequence
+ true //take ownership of the data
+ );
+
+ return package;
+}
+
+::Deployment::Implementation * CIAO_new_RepositoryManagerDaemon_i::findImplementationByName (
+ const char * implementation_name,
+ const char * package_name
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ ::Deployment::NoSuchName
+ ))
+{
+ // Add your implementation here
+
+ //form the path to the archive in the local filesystem
+ ACE_CString path (RM_STORAGE_PATH);
+ path += "/";
+ path += package_name;
+ path += ".cpk";
+
+
+ ACE_CString artifact ("implementations/");
+ artifact += implementation_name;
+
+ //create a ZIP wrapper
+ ZIP_Wrapper zip;
+
+ //read in artifact
+ ACE_Message_Block file (0,0);
+ if (!zip.get_file( const_cast<char*> (path.c_str ()), const_cast<char*> (artifact.c_str ()), file))
+ {
+ cout << "Unable to retrieve file!" << endl;
+ ACE_THROW_RETURN (Deployment::NoSuchName (), 0);
+ }
+
+ Deployment::Implementation* impl = new Deployment::Implementation ();
+
+ //initialize the Implementation struct and allocate the buffer to hold the data
+ impl->name = implementation_name;
+ impl->the_implementation.replace (
+ file.total_length (), //max of the sequence
+ file.total_length (), //length of the sequence
+ Deployment::Artifact::allocbuf (file.total_length ()), //data to be stored within the sequence
+ true //take ownership of the data
+ );
+
+ //impl->the_platform = UNDEF; //Deployment::Platform
+
+ CORBA::Octet* ptr = impl->the_implementation.get_buffer ();
+
+ //place the Artifact in the Implementation struct
+ for (ACE_Message_Block * curr = &file; curr != 0; curr = curr->cont ())
+ {
+ if (!ACE_OS::memcpy (ptr, curr->rd_ptr(), curr->length()))
+ ACE_THROW_RETURN (CORBA::INTERNAL (), 0);
+
+ ptr += curr->length ();
+ }
+
+ return impl;
+}
+
+::Deployment::Package * CIAO_new_RepositoryManagerDaemon_i::findPackageByUUID (
+ const char * UUID
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ ::Deployment::NoSuchName
+ ))
+{
+ // Add your implementation here
+ ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0);
+}
+
+::Deployment::Implementation * CIAO_new_RepositoryManagerDaemon_i::findImplementationByUUID (
+ const char * UUID
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ ::Deployment::NoSuchName
+ ))
+{
+ // Add your implementation here
+ ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0);
+}
+
+::CORBA::StringSeq * CIAO_new_RepositoryManagerDaemon_i::getAllPackageNames (
+
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ))
+{
+ // Add your implementation here
+
+ CORBA::ULong num_entries = this->packages_.current_size ();
+ CORBA::StringSeq_var seq = new CORBA::StringSeq (num_entries);
+
+ CORBA::ULong index = 0;
+ for (RepositoryDatabase_Iterator iter = this->packages_.begin ();
+ iter != this->packages_.end () && index < num_entries;
+ iter++)
+
+ seq[index] = const_cast<char*> (((*iter).int_id_).c_str ()); //this looks hideous, but as lond as it works!
+
+
+ return seq._retn (); //release the underlying CORBA::StringSeq
+}
+
+
+
+// Find out if the package was installed in the repository,
+// delete it if found or throw and exception otherwise
+
+void CIAO_new_RepositoryManagerDaemon_i::deletePackage (
+ const char * installationName
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ ::Deployment::NoSuchName
+ ))
+{
+ // Add your implementation here
+
+ ACE_Hash_Map_Entry <ACE_CString, ACE_CString> *entry;
+
+ if (this->packages_.find (ACE_CString (installationName), entry) != 0)
+ ACE_THROW (Deployment::NoSuchName ());
+ else
+ this->packages_.unbind (installationName);
+
+ //actually delete the package here!
+
+ ACE_CString path (RM_STORAGE_PATH);
+ path += "/";
+ path += installationName;
+ path += ".cpk";
+
+ remove (path.c_str ());
+}
+
+
+int CIAO_new_RepositoryManagerDaemon_i::write_to_disk (
+ const char* full_path,
+ const CORBA::Octet* buffer,
+ size_t length
+ )
+{
+
+ // Open a file handle to the local filesystem
+ ACE_HANDLE handle = ACE_OS::open (full_path, _O_CREAT | _O_TRUNC | O_WRONLY);
+ if (handle == ACE_INVALID_HANDLE)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("%p\n"),
+ ACE_TEXT ("[RM::write_to_disk] file creation error")),
+ -1);
+
+ //write the data to the file
+ if (ACE_OS::write (handle, buffer, length) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("%p\n"),
+ ACE_TEXT ("[RM::write_to_disk] file write error")),
+ -1);
+
+ // Close the file handle
+ ACE_OS::close (handle);
+
+ return 1;
+}
+
+
+int CIAO_new_RepositoryManagerDaemon_i::write_to_disk
+ (const char* full_path,
+ ACE_Message_Block& mb,
+ bool replace
+ )
+{
+
+ ACE_stat stat;
+
+ if (ACE_OS::stat(full_path, &stat) != -1 && !replace)
+ return 0;
+
+ // Open a file handle to the local filesystem
+ ACE_HANDLE handle = ACE_OS::open (full_path, _O_CREAT | _O_TRUNC | O_WRONLY);
+ if (handle == ACE_INVALID_HANDLE)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("%p\n"),
+ ACE_TEXT ("[RM::write_to_disk] file creation error")),
+ -1);
+
+ //write the data to the file
+ for (ACE_Message_Block * curr = &mb; curr != 0; curr = curr->cont ())
+ if (ACE_OS::write_n (handle, curr->rd_ptr(), curr->length()) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("%p\n"),
+ ACE_TEXT ("write error")),
+ -1);
+
+ // Close the file handle
+ ACE_OS::close (handle);
+
+ return 1;
+}
+
+
+CORBA::Octet* CIAO_new_RepositoryManagerDaemon_i::read_from_disk (
+ const char* full_path,
+ size_t &length
+ )
+{
+ //open the file
+
+ ACE_HANDLE handle = ACE_OS::open (full_path, O_RDONLY);
+ if (handle == ACE_INVALID_HANDLE)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("%p\n"),
+ ACE_TEXT ("[RM::read_from_disk] file open error")),
+ 0);
+
+ ACE_stat file_info;
+
+ ACE_OS::fstat (handle, &file_info);
+
+ CORBA::Octet* buffer = new CORBA::Octet[file_info.st_size];
+
+ if (buffer == 0)
+ return 0;
+
+ //read the contents of the file into the buffer
+ if (ACE_OS::read_n (handle, buffer, file_info.st_size) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("%p\n"),
+ ACE_TEXT ("[RM::write_to_disk] file write error")),
+ 0);
+
+ // Close the file handle
+ ACE_OS::close (handle);
+
+ length = file_info.st_size;
+ return buffer;
+}
+
diff --git a/TAO/CIAO/DAnCE/new_RepositoryManager/new_RepositoryManager_Impl.h b/TAO/CIAO/DAnCE/new_RepositoryManager/new_RepositoryManager_Impl.h
new file mode 100644
index 00000000000..f544aa6e63d
--- /dev/null
+++ b/TAO/CIAO/DAnCE/new_RepositoryManager/new_RepositoryManager_Impl.h
@@ -0,0 +1,207 @@
+// $Id$
+
+///====================================================================
+//@filename: new_RepositoryManager_Impl.h
+//@Author: Stoyan Paunov spaunov@isis.vanderbilt.edu
+//
+//@Purpose: This class is the implementation class for the new
+// RepositoryManager
+
+
+
+// -*- C++ -*-
+//
+// $Id$
+
+// **** Code generated by the The ACE ORB (TAO) IDL Compiler ****
+// TAO and the TAO IDL Compiler have been developed by:
+// Center for Distributed Object Computing
+// Washington University
+// St. Louis, MO
+// USA
+// http://www.cs.wustl.edu/~schmidt/doc-center.html
+// and
+// Distributed Object Computing Laboratory
+// University of California at Irvine
+// Irvine, CA
+// USA
+// http://doc.ece.uci.edu/
+// and
+// Institute for Software Integrated Systems
+// Vanderbilt University
+// Nashville, TN
+// USA
+// http://www.isis.vanderbilt.edu/
+//
+// Information about TAO is available at:
+// http://www.cs.wustl.edu/~schmidt/TAO.html
+
+// TAO_IDL - Generated from
+// .\be\be_codegen.cpp:873
+
+#ifndef NEW_REPOSITORYMANAGERI_H_
+#define NEW_REPOSITORYMANAGERI_H_
+
+#include "new_RepositoryManagerS.h"
+#include "DeploymentS.h" //added for the deployment stuff
+
+#include "ace/Hash_Map_Manager.h" //for the ACE_Hash_Map_Manager
+#include "ace/Null_Mutex.h" //for ACE_Null_Mutex
+#include "ace/OS_NS_string.h" //for ACE_CString
+#include "ace/SString.h"
+
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+#pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+
+///DIRECTORY WHERE THE PACKAGES WILL BE STORED LOCALLY
+const static char* RM_STORAGE_PATH = "./RepositoryDir";
+
+
+class CIAO_new_RepositoryManagerDaemon_i : public virtual POA_CIAO::new_RepositoryManagerDaemon, public virtual PortableServer::RefCountServantBase
+{
+public:
+
+ //Constructor
+ CIAO_new_RepositoryManagerDaemon_i (CORBA::ORB_ptr the_orb);
+
+ //Destructor
+ virtual ~CIAO_new_RepositoryManagerDaemon_i (void);
+
+ virtual
+ void shutdown (
+
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ virtual
+ void installPackage (
+ const char * installationName,
+ const ::Deployment::Package & the_package,
+ ::CORBA::Boolean replace
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ ::Deployment::NameExists,
+ ::Deployment::PackageError
+ ));
+
+ virtual
+ ::Deployment::DeploymentPlan * retrievePlan (
+ const char * packageName
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ virtual
+ ::Deployment::Package * findPackageByName (
+ const char * name
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ ::Deployment::NoSuchName
+ ));
+
+ virtual
+ ::Deployment::Implementation * findImplementationByName (
+ const char * implementation_name,
+ const char * package_name
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ ::Deployment::NoSuchName
+ ));
+
+ virtual
+ ::Deployment::Package * findPackageByUUID (
+ const char * UUID
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ ::Deployment::NoSuchName
+ ));
+
+ virtual
+ ::Deployment::Implementation * findImplementationByUUID (
+ const char * UUID
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ ::Deployment::NoSuchName
+ ));
+
+ virtual
+ ::CORBA::StringSeq * getAllPackageNames (
+
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ ));
+
+ virtual
+ void deletePackage (
+ const char * installationName
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException,
+ ::Deployment::NoSuchName
+ ));
+
+
+ protected:
+
+ ///function that writes out a file to a specified location on the hand disk
+ ///returns 1 on success
+ /// -1 on error
+
+ int write_to_disk (const char* full_path,
+ const CORBA::Octet* buffer,
+ size_t length
+ );
+
+
+ ///function that writes out a file to a specified location on the hand disk
+ ///returns 1 on success
+ /// 0 on already exists and replace == false
+ /// -1 on error
+
+ int write_to_disk (const char* full_path,
+ ACE_Message_Block& mb,
+ bool replace = true
+ );
+
+
+ ///function to read the contents of a file from disk into a CORBA::OctetSeq
+ ///returns a pointer to a CORBA::Octet buffer and updated the lenght on success
+ /// 0 on failure
+
+ CORBA::Octet* read_from_disk (const char* full_path, size_t &lenght);
+
+ private:
+ /// Cached information about the installed packages
+ /// and the Implementation Artifacts within them
+ /// Key: Package name of CString type or
+ /// Value: The location of the local copy of the package
+
+ typedef ACE_Hash_Map_Manager_Ex<ACE_CString,
+ ACE_CString,
+ ACE_Hash<ACE_CString>,
+ ACE_Equal_To<ACE_CString>,
+ ACE_Null_Mutex> RepositoryDatabase;
+
+
+ typedef RepositoryDatabase::iterator RepositoryDatabase_Iterator;
+
+ RepositoryDatabase packages_;
+ CORBA::ORB_var the_orb_;
+
+};
+
+
+#endif /* NEW_REPOSITORYMANAGERI_H_ */
+
diff --git a/TAO/CIAO/DAnCE/new_RepositoryManager/packages/inconsistent.cpk b/TAO/CIAO/DAnCE/new_RepositoryManager/packages/inconsistent.cpk
new file mode 100644
index 00000000000..c944a2d25dd
--- /dev/null
+++ b/TAO/CIAO/DAnCE/new_RepositoryManager/packages/inconsistent.cpk
Binary files differ
diff --git a/TAO/CIAO/DAnCE/new_RepositoryManager/packages/package.cpk b/TAO/CIAO/DAnCE/new_RepositoryManager/packages/package.cpk
new file mode 100644
index 00000000000..ed3721f3165
--- /dev/null
+++ b/TAO/CIAO/DAnCE/new_RepositoryManager/packages/package.cpk
Binary files differ