Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » private package imports
private package imports [message #469902] Sat, 03 February 2007 05:42 Go to next message
Rafael Chaves is currently offline Rafael ChavesFriend
Messages: 362
Registered: July 2009
Senior Member
I am trying to handle private package imports, with no success.

Let's say we have a model "modelA" that declares a class named "Class1":

<?xml version="1.0" encoding="UTF-8"?>
<uml:Model xmi:version="2.1"
xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
xmlns:uml="http://www.eclipse.org/uml2/2.0.0/UML"
xmi:id="_2lOwILNDEduNmdZ-0W_wwA" name="modelA">
<packagedElement xmi:type="uml:Class"
xmi:id="_5ddhgLNDEduNmdZ-0W_wwA" name="Class1">
</packagedElement>
</uml:Model>

And another model "modelB" that all it does is to import "modelA" with a
private PackageImport:

<?xml version="1.0" encoding="UTF-8"?>
<uml:Model xmi:version="2.1"
xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
xmlns:uml="http://www.eclipse.org/uml2/2.0.0/UML"
xmi:id="_S7eQILNIEduJpMikpuhDAQ" name="
<packageImport xmi:id="_S7qdYbNIEduJpMikpuhDAQ" visibility="private">
<importedPackage xmi:type="uml:Model"
href="modelA.uml#_S7L8QLNIEduJpMikpuhDAQ"/>
</packageImport>
</uml:Model>

So that tells me that all elements imported from modelA into modelB are
private to modelB (section 7.3.39 - "If the PackageImport is public, the
imported elements will be visible outside the package, while if it is
private they will not.").

I am trying to honor the UML spec and prevent people from creating
models that import modelB to make references to Class1, but the problem
is that the visibility of modelB::Class1 (in other words, modelA::Class1
as imported into modelB) is public. Shouldn't it be private instead? Is
this a bug in UML2? Any workarounds?

Thanks,

Rafael
Re: private package imports [message #470061 is a reply to message #469902] Mon, 05 February 2007 20:23 Go to previous messageGo to next message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Rafael,

The PackageOperations::getAllImportedPackages() does consider visibility
kind when returning the list of imported packages.
Also, the PackageOperations::visibleMembers() convenience method uses only
publicly available members.

Try using that PackageOperations::visible() query.


Regards,
- James.


"Rafael Chaves" <chaves@inf.ufsc.nospam.br> wrote in message
news:eq17b5$uvm$1@utils.eclipse.org...
> I am trying to handle private package imports, with no success.
>
> Let's say we have a model "modelA" that declares a class named "Class1":
>
> <?xml version="1.0" encoding="UTF-8"?>
> <uml:Model xmi:version="2.1"
> xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
> xmlns:uml="http://www.eclipse.org/uml2/2.0.0/UML"
> xmi:id="_2lOwILNDEduNmdZ-0W_wwA" name="modelA">
> <packagedElement xmi:type="uml:Class"
> xmi:id="_5ddhgLNDEduNmdZ-0W_wwA" name="Class1">
> </packagedElement>
> </uml:Model>
>
> And another model "modelB" that all it does is to import "modelA" with a
> private PackageImport:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <uml:Model xmi:version="2.1"
> xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
> xmlns:uml="http://www.eclipse.org/uml2/2.0.0/UML"
> xmi:id="_S7eQILNIEduJpMikpuhDAQ" name="
> <packageImport xmi:id="_S7qdYbNIEduJpMikpuhDAQ" visibility="private">
> <importedPackage xmi:type="uml:Model"
> href="modelA.uml#_S7L8QLNIEduJpMikpuhDAQ"/>
> </packageImport>
> </uml:Model>
>
> So that tells me that all elements imported from modelA into modelB are
> private to modelB (section 7.3.39 - "If the PackageImport is public, the
> imported elements will be visible outside the package, while if it is
> private they will not.").
>
> I am trying to honor the UML spec and prevent people from creating
> models that import modelB to make references to Class1, but the problem
> is that the visibility of modelB::Class1 (in other words, modelA::Class1
> as imported into modelB) is public. Shouldn't it be private instead? Is
> this a bug in UML2? Any workarounds?
>
> Thanks,
>
> Rafael
Re: private package imports [message #470064 is a reply to message #470061] Mon, 05 February 2007 20:25 Go to previous messageGo to next message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
.... I meant PackageOperations::visibleMembers() query...



"James Bruck" <jbruck@ca.ibm.com> wrote in message
news:eq83og$i8t$2@utils.eclipse.org...
> Hi Rafael,
>
> The PackageOperations::getAllImportedPackages() does consider visibility
> kind when returning the list of imported packages.
> Also, the PackageOperations::visibleMembers() convenience method uses only
> publicly available members.
>
> Try using that PackageOperations::visible() query.
>
>
> Regards,
> - James.
>
>
> "Rafael Chaves" <chaves@inf.ufsc.nospam.br> wrote in message
> news:eq17b5$uvm$1@utils.eclipse.org...
> > I am trying to handle private package imports, with no success.
> >
> > Let's say we have a model "modelA" that declares a class named "Class1":
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <uml:Model xmi:version="2.1"
> > xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
> > xmlns:uml="http://www.eclipse.org/uml2/2.0.0/UML"
> > xmi:id="_2lOwILNDEduNmdZ-0W_wwA" name="modelA">
> > <packagedElement xmi:type="uml:Class"
> > xmi:id="_5ddhgLNDEduNmdZ-0W_wwA" name="Class1">
> > </packagedElement>
> > </uml:Model>
> >
> > And another model "modelB" that all it does is to import "modelA" with a
> > private PackageImport:
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <uml:Model xmi:version="2.1"
> > xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
> > xmlns:uml="http://www.eclipse.org/uml2/2.0.0/UML"
> > xmi:id="_S7eQILNIEduJpMikpuhDAQ" name="
> > <packageImport xmi:id="_S7qdYbNIEduJpMikpuhDAQ" visibility="private">
> > <importedPackage xmi:type="uml:Model"
> > href="modelA.uml#_S7L8QLNIEduJpMikpuhDAQ"/>
> > </packageImport>
> > </uml:Model>
> >
> > So that tells me that all elements imported from modelA into modelB are
> > private to modelB (section 7.3.39 - "If the PackageImport is public, the
> > imported elements will be visible outside the package, while if it is
> > private they will not.").
> >
> > I am trying to honor the UML spec and prevent people from creating
> > models that import modelB to make references to Class1, but the problem
> > is that the visibility of modelB::Class1 (in other words, modelA::Class1
> > as imported into modelB) is public. Shouldn't it be private instead? Is
> > this a bug in UML2? Any workarounds?
> >
> > Thanks,
> >
> > Rafael
>
>
Re: private package imports [message #470076 is a reply to message #470064] Mon, 05 February 2007 21:16 Go to previous message
Kenn Hussey is currently offline Kenn HusseyFriend
Messages: 1620
Registered: July 2009
Senior Member
Actually, PackageOperations::visibleMembers(Package) is not API (it's
internal) - use Package#visibleMembers() instead.

Kenn

"James Bruck" <jbruck@ca.ibm.com> wrote in message
news:eq83qs$ids$2@utils.eclipse.org...
> ... I meant PackageOperations::visibleMembers() query...
>
>
>
> "James Bruck" <jbruck@ca.ibm.com> wrote in message
> news:eq83og$i8t$2@utils.eclipse.org...
>> Hi Rafael,
>>
>> The PackageOperations::getAllImportedPackages() does consider visibility
>> kind when returning the list of imported packages.
>> Also, the PackageOperations::visibleMembers() convenience method uses
>> only
>> publicly available members.
>>
>> Try using that PackageOperations::visible() query.
>>
>>
>> Regards,
>> - James.
>>
>>
>> "Rafael Chaves" <chaves@inf.ufsc.nospam.br> wrote in message
>> news:eq17b5$uvm$1@utils.eclipse.org...
>> > I am trying to handle private package imports, with no success.
>> >
>> > Let's say we have a model "modelA" that declares a class named
>> > "Class1":
>> >
>> > <?xml version="1.0" encoding="UTF-8"?>
>> > <uml:Model xmi:version="2.1"
>> > xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
>> > xmlns:uml="http://www.eclipse.org/uml2/2.0.0/UML"
>> > xmi:id="_2lOwILNDEduNmdZ-0W_wwA" name="modelA">
>> > <packagedElement xmi:type="uml:Class"
>> > xmi:id="_5ddhgLNDEduNmdZ-0W_wwA" name="Class1">
>> > </packagedElement>
>> > </uml:Model>
>> >
>> > And another model "modelB" that all it does is to import "modelA" with
>> > a
>> > private PackageImport:
>> >
>> > <?xml version="1.0" encoding="UTF-8"?>
>> > <uml:Model xmi:version="2.1"
>> > xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
>> > xmlns:uml="http://www.eclipse.org/uml2/2.0.0/UML"
>> > xmi:id="_S7eQILNIEduJpMikpuhDAQ" name="
>> > <packageImport xmi:id="_S7qdYbNIEduJpMikpuhDAQ"
>> > visibility="private">
>> > <importedPackage xmi:type="uml:Model"
>> > href="modelA.uml#_S7L8QLNIEduJpMikpuhDAQ"/>
>> > </packageImport>
>> > </uml:Model>
>> >
>> > So that tells me that all elements imported from modelA into modelB are
>> > private to modelB (section 7.3.39 - "If the PackageImport is public,
>> > the
>> > imported elements will be visible outside the package, while if it is
>> > private they will not.").
>> >
>> > I am trying to honor the UML spec and prevent people from creating
>> > models that import modelB to make references to Class1, but the problem
>> > is that the visibility of modelB::Class1 (in other words,
>> > modelA::Class1
>> > as imported into modelB) is public. Shouldn't it be private instead? Is
>> > this a bug in UML2? Any workarounds?
>> >
>> > Thanks,
>> >
>> > Rafael
>>
>>
>
>
Re: private package imports [message #582047 is a reply to message #469902] Mon, 05 February 2007 20:23 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
Hi Rafael,

The PackageOperations::getAllImportedPackages() does consider visibility
kind when returning the list of imported packages.
Also, the PackageOperations::visibleMembers() convenience method uses only
publicly available members.

Try using that PackageOperations::visible() query.


Regards,
- James.


"Rafael Chaves" <chaves@inf.ufsc.nospam.br> wrote in message
news:eq17b5$uvm$1@utils.eclipse.org...
> I am trying to handle private package imports, with no success.
>
> Let's say we have a model "modelA" that declares a class named "Class1":
>
> <?xml version="1.0" encoding="UTF-8"?>
> <uml:Model xmi:version="2.1"
> xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
> xmlns:uml="http://www.eclipse.org/uml2/2.0.0/UML"
> xmi:id="_2lOwILNDEduNmdZ-0W_wwA" name="modelA">
> <packagedElement xmi:type="uml:Class"
> xmi:id="_5ddhgLNDEduNmdZ-0W_wwA" name="Class1">
> </packagedElement>
> </uml:Model>
>
> And another model "modelB" that all it does is to import "modelA" with a
> private PackageImport:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <uml:Model xmi:version="2.1"
> xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
> xmlns:uml="http://www.eclipse.org/uml2/2.0.0/UML"
> xmi:id="_S7eQILNIEduJpMikpuhDAQ" name="
> <packageImport xmi:id="_S7qdYbNIEduJpMikpuhDAQ" visibility="private">
> <importedPackage xmi:type="uml:Model"
> href="modelA.uml#_S7L8QLNIEduJpMikpuhDAQ"/>
> </packageImport>
> </uml:Model>
>
> So that tells me that all elements imported from modelA into modelB are
> private to modelB (section 7.3.39 - "If the PackageImport is public, the
> imported elements will be visible outside the package, while if it is
> private they will not.").
>
> I am trying to honor the UML spec and prevent people from creating
> models that import modelB to make references to Class1, but the problem
> is that the visibility of modelB::Class1 (in other words, modelA::Class1
> as imported into modelB) is public. Shouldn't it be private instead? Is
> this a bug in UML2? Any workarounds?
>
> Thanks,
>
> Rafael
Re: private package imports [message #582062 is a reply to message #470061] Mon, 05 February 2007 20:25 Go to previous message
james bruck is currently offline james bruckFriend
Messages: 1724
Registered: July 2009
Senior Member
.... I meant PackageOperations::visibleMembers() query...



"James Bruck" <jbruck@ca.ibm.com> wrote in message
news:eq83og$i8t$2@utils.eclipse.org...
> Hi Rafael,
>
> The PackageOperations::getAllImportedPackages() does consider visibility
> kind when returning the list of imported packages.
> Also, the PackageOperations::visibleMembers() convenience method uses only
> publicly available members.
>
> Try using that PackageOperations::visible() query.
>
>
> Regards,
> - James.
>
>
> "Rafael Chaves" <chaves@inf.ufsc.nospam.br> wrote in message
> news:eq17b5$uvm$1@utils.eclipse.org...
> > I am trying to handle private package imports, with no success.
> >
> > Let's say we have a model "modelA" that declares a class named "Class1":
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <uml:Model xmi:version="2.1"
> > xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
> > xmlns:uml="http://www.eclipse.org/uml2/2.0.0/UML"
> > xmi:id="_2lOwILNDEduNmdZ-0W_wwA" name="modelA">
> > <packagedElement xmi:type="uml:Class"
> > xmi:id="_5ddhgLNDEduNmdZ-0W_wwA" name="Class1">
> > </packagedElement>
> > </uml:Model>
> >
> > And another model "modelB" that all it does is to import "modelA" with a
> > private PackageImport:
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <uml:Model xmi:version="2.1"
> > xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
> > xmlns:uml="http://www.eclipse.org/uml2/2.0.0/UML"
> > xmi:id="_S7eQILNIEduJpMikpuhDAQ" name="
> > <packageImport xmi:id="_S7qdYbNIEduJpMikpuhDAQ" visibility="private">
> > <importedPackage xmi:type="uml:Model"
> > href="modelA.uml#_S7L8QLNIEduJpMikpuhDAQ"/>
> > </packageImport>
> > </uml:Model>
> >
> > So that tells me that all elements imported from modelA into modelB are
> > private to modelB (section 7.3.39 - "If the PackageImport is public, the
> > imported elements will be visible outside the package, while if it is
> > private they will not.").
> >
> > I am trying to honor the UML spec and prevent people from creating
> > models that import modelB to make references to Class1, but the problem
> > is that the visibility of modelB::Class1 (in other words, modelA::Class1
> > as imported into modelB) is public. Shouldn't it be private instead? Is
> > this a bug in UML2? Any workarounds?
> >
> > Thanks,
> >
> > Rafael
>
>
Re: private package imports [message #582167 is a reply to message #470064] Mon, 05 February 2007 21:16 Go to previous message
Kenn Hussey is currently offline Kenn HusseyFriend
Messages: 1620
Registered: July 2009
Senior Member
Actually, PackageOperations::visibleMembers(Package) is not API (it's
internal) - use Package#visibleMembers() instead.

Kenn

"James Bruck" <jbruck@ca.ibm.com> wrote in message
news:eq83qs$ids$2@utils.eclipse.org...
> ... I meant PackageOperations::visibleMembers() query...
>
>
>
> "James Bruck" <jbruck@ca.ibm.com> wrote in message
> news:eq83og$i8t$2@utils.eclipse.org...
>> Hi Rafael,
>>
>> The PackageOperations::getAllImportedPackages() does consider visibility
>> kind when returning the list of imported packages.
>> Also, the PackageOperations::visibleMembers() convenience method uses
>> only
>> publicly available members.
>>
>> Try using that PackageOperations::visible() query.
>>
>>
>> Regards,
>> - James.
>>
>>
>> "Rafael Chaves" <chaves@inf.ufsc.nospam.br> wrote in message
>> news:eq17b5$uvm$1@utils.eclipse.org...
>> > I am trying to handle private package imports, with no success.
>> >
>> > Let's say we have a model "modelA" that declares a class named
>> > "Class1":
>> >
>> > <?xml version="1.0" encoding="UTF-8"?>
>> > <uml:Model xmi:version="2.1"
>> > xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
>> > xmlns:uml="http://www.eclipse.org/uml2/2.0.0/UML"
>> > xmi:id="_2lOwILNDEduNmdZ-0W_wwA" name="modelA">
>> > <packagedElement xmi:type="uml:Class"
>> > xmi:id="_5ddhgLNDEduNmdZ-0W_wwA" name="Class1">
>> > </packagedElement>
>> > </uml:Model>
>> >
>> > And another model "modelB" that all it does is to import "modelA" with
>> > a
>> > private PackageImport:
>> >
>> > <?xml version="1.0" encoding="UTF-8"?>
>> > <uml:Model xmi:version="2.1"
>> > xmlns:xmi="http://schema.omg.org/spec/XMI/2.1"
>> > xmlns:uml="http://www.eclipse.org/uml2/2.0.0/UML"
>> > xmi:id="_S7eQILNIEduJpMikpuhDAQ" name="
>> > <packageImport xmi:id="_S7qdYbNIEduJpMikpuhDAQ"
>> > visibility="private">
>> > <importedPackage xmi:type="uml:Model"
>> > href="modelA.uml#_S7L8QLNIEduJpMikpuhDAQ"/>
>> > </packageImport>
>> > </uml:Model>
>> >
>> > So that tells me that all elements imported from modelA into modelB are
>> > private to modelB (section 7.3.39 - "If the PackageImport is public,
>> > the
>> > imported elements will be visible outside the package, while if it is
>> > private they will not.").
>> >
>> > I am trying to honor the UML spec and prevent people from creating
>> > models that import modelB to make references to Class1, but the problem
>> > is that the visibility of modelB::Class1 (in other words,
>> > modelA::Class1
>> > as imported into modelB) is public. Shouldn't it be private instead? Is
>> > this a bug in UML2? Any workarounds?
>> >
>> > Thanks,
>> >
>> > Rafael
>>
>>
>
>
Previous Topic:UML2 installation question
Next Topic:strange behavior when defining a profile
Goto Forum:
  


Current Time: Tue Apr 07 21:25:26 GMT 2020

Powered by FUDForum. Page generated in 0.02766 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top