Solved

How to restrict method access outside of jar or set of packages

Posted on 2006-11-07
10
464 Views
Last Modified: 2013-11-23
Hi all
I have a base class – WebContainer from which I derive two classes, Request class and Response class.
WebContainer is a like aMap and donate both get() and set() methods for both derived classes .
The entire project is packaged into a jar and distributed to other development teams.
The team's has no need of calling request.set(objId) or response.get(objId), they only use request.get(objId) and
All set() method usages are restricted to classes in the jar file (sevarel of packages) .
What I can do is declare the request.set , and response.get methods as deprecated, so the teams will no not to use them ,
Is there any other way I can prevent them from accessing these methods?
Thank you
Sharon
0
Comment
Question by:sharon669
  • 4
  • 2
10 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 17893273
Try installing a SecurityManager
0
 
LVL 92

Accepted Solution

by:
objects earned 250 total points
ID: 17893281
best would be to declare them package protected, and put any of your classes that need them in the same package
0
 
LVL 92

Expert Comment

by:objects
ID: 17893286
if you just want to mark them then use deplecated

http://java.sun.com/j2se/1.4.2/docs/guide/misc/deprecation/deprecated.html
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 1

Author Comment

by:sharon669
ID: 17893543
objects  >>>  and put any of your classes that need them in the same package
The project is large scale entrprise application ,and  we commonly use the Request/Reponse objects in all packages ,

objects  >>>  if you just want to mark them then use deplecated
quote from the question :
>What I can do is declare the request.set , and response.get methods as deprecated, so ....
this way the programmers who develop the Jar will be bothered from the warning generated by the compiler .
isn't there any elegant solution ?

thank you for your time !
Sharon
0
 
LVL 92

Expert Comment

by:objects
ID: 17894828
> and  we commonly use the Request/Reponse objects in all packages

you can still use the objects, you just want to limit the visibility of those methods
0
 
LVL 1

Author Comment

by:sharon669
ID: 17917453
will SecurityManager cause significant overhead  to a large scale j2ee app ?
0
 
LVL 92

Expert Comment

by:objects
ID: 17918031
how would you use a security manager?
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Performance issue while iterating with streams 5 39
IT Company 5 69
array11 challenge 16 51
word0 challenge 3 58
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This video teaches viewers about errors in exception handling.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now