Extending Policy Class
I'm having a bit of trouble understanding how to extend the Policy class properly.
First, when a permission is checked by,
AccessControlContext.checkPermission(Permission), how does it check with the Policy if a permission is allowed or not.
Second, which method do I need to override in order for permissions to be checked properly under my Policy?
I've seen one example where a method was added:
PermissionCollection getPermission(Subject,CodeSource). I want a method like that, but how would I get it be used in Permission checks?
As a temporary fix,
I have done it working by setting it in the code.
Policy.setPolicy("com.test.MyJaasPolicy");And adding this permission in the policy file,
permission java.security.SecurityPermission "setPolicy";..Thiruppathy.R
Similar Messages
-
Working with traits and policy classes
I have not been able to see if anyone has raised this before from my searches of the forums but this may just be bad searching !
I am trying to investigate how much of the traits / policies idioms of working in C++ generic programming are applicable to Java. The following trio of classes are a very striped down version of one problem I am having. It relates to the use of static methods, inheritance and generic classes.
First a couple of classes with static methods related by inheritance.
public class X {
public static int get() {
System.err.println("X.get.") ;
return 1 ;
public class Y extends X {
public static int get() {
System.err.println("Y.get.") ;
return X.get() + 1 ;
}Now a class that uses the types as type parameters and tries to call the static method:
public class TypeParameterLookupSolved<A extends X> {
private void doit() {
System.out.println(A.get()) ;
public static void main(final String[] args) {
TypeParameterLookupSolved<Y> tpli = new TypeParameterLookupSolved<Y> () ;
tpli.doit() ;
}The output from running this is:
X.get.
1
So the question is why does the call of A.get() always bind to X.get() when na�vely you would expect Y.get() to be called.
If Java will only ever call X.get() in this instance then the policy class idiom will not work properly . Of course it may be that there is another way of doing this that I have missed.
Thanks.Thanks for the correction.
I never can get the hang of up and down in type hierarchies -- functional programming people talk a lot about top and bottom in type hierarchies and I never remember which is which. One of these days I will find a mechanism for putting the knowledge into long-term memory :-)
Having had the epiphany of "least upper bounds", it is now trivially easy to do Java-style generic programming (which is good :-) even though it is totally different to everyone else (C++, Python, Groovy, Ruby, Nice, CL, OCAML, Haskell, . . .-- which is not so good). I am increasingly of the view that using the term Generics has been a labelling error and an unfortunate disservice to Java as it can set up a mind-set about parameterized types and "generic programming" that is fundamentally wrong. I can feel a series of short articles coming on as well as sorting out my ADS library! -
Is it possible to create a javafx class without extending Application class ? If yes, how ?
There is no such thing as a javafx class. It is a regular java class. The Aapplication class is the entry
point for JavaFX application. You have to extend the Application class to create Javafx application . -
LoadClass (error loading a class which extends other class at run-time)
Hey!
I'm using the Reflection API
I load a class called 'SubClass' which exists in a directory called 'subdir' at run-time from my program
CustomClassLoader loader = new CustomClassLoader();
Class classRef = loader.loadClass("SubClass");
class CustomClassLoader extends ClassLoader. I have defined 'findClass(String className)' method in CustomClassLoader.
This is what 'findClass(String className)' returns:
defineClass (className,byteArray,0,byteArray.length);
'byteArray' is of type byte[] and has the contents of subdir/SubClass.
the problem:
The program runs fine if SubClass does not extend any class.
If however, SubClass extends another class, the program throws a NoClassDefFoundError. How is it conceptually different?
Help appreciated in Advance..
Thanks!Because i'm a newbie to the Reflection thing, i'm notI don't see reflection anywhere. All I see is class loading.
sure what role does the superclass play when i'm
trying to load the derived class and how to get away
with the errorWell... hint: all the superclass's stuff is not copied into the subclass.
I am quite sure it fails to load the superclass because of classpath issues. -
Error while extending controller: class name is wrong or not included
Hi All,
I am getting this error while I port my extended controller class to the custom top and assign this controller to the page. I have made sure its the class file that is copied. The directory is correct, the permissions were given using chmod 775. There exists a soft link betwen the custom top and the oracle top as well. What else am I missing here?
Error: oracle.apps.fnd.framework.OAException: Could not create Java class: (oracle.apps.ap.oie.entry.webui.XXEntryFlowPageCO) associated with region: (GeneralInformationPG). This is probably because the class name is wrong or not included in project.:( Started out with that Gyan. If i do give the path with xx. appended to it, it lets me save and when i log back in and there are no changes to the page. I go to the personalise option to find the modification has been overwritten. I was told that this is so because Oracle doesnt recognise the xx.path and since there exists a soft link already the standard path with the new controller name should work.
i have really tried both of these options and am not sure what could be wrong. thanks for all your attempts to help. anything else i can try? -
Loading external swfs extending from classes in the same shared codebase
Hey there!
I'm currently developing a game in flash and want to be able to divide up my .fla assets in a way that means artists can work on a game menu .fla in isolation from the game.fla and rest of the game code.
If I could briefly explain how I've approached this so far, I would be extremely if people could shout in my general direction and tell me I am stupid, or even better still, give me helpful advice as to where I am going wrong and how I can correct it!
My project is setup like this:
HighScoreMenu.fla -> document class HighScoreMenu extending GameMenu class.
game.fla ->document class game.as
game.as class loads the published HighScoreMenu.swf and manipulates the menu i.e. animates on and off screen via inherited functions in the GameMenu class.
Now this seemed to work to begin with, until my code evolved and upon going to publish my HighScoreMenu.fla flash started complaining about symbols being used in Game.as that were in Game.fla... If I'm only publishing the HighScoreMenu which extends from GameMenu then why is it even looking to compile Game.as?
Can you spot the problem in the way I am doing this, or is there a better approach I should try?
Any advice greatly appreciated!
Stevie.No it doesn't seem to, however though they both have a reference to the HighScoreManager so there is some overlap there between menu and game code, but the menu classes don't reference any symbols on the game.fla...
Just to clarify, I have an fla HighScoreMenu.fla, which has a child symbol HighScoreMenu which uses the following class.
public dynamic class HighScoreMenu extends GameMenu
//convenient storage for competition Manager object
private var _highScoreManager:HighScoreManager;
The game then loads this class as follows:
I load the swf "HighScoreMenu.swf" and once its loaded I obtain the menu class like so:
var cls:Class = Class( applicationDomain.getDefinition("Menus.HighScoreMenu") );
var object:* = new cls();
...and create a new instance of the menu.
Is there anything fundamentally wrong with approaching it in this way? -
Not able to pass values to variables in extended Tree class
Hi,
I have a as class that extends from Tree, additionally this
custom class defines
new class level variables as follows:
public class MyTree extends Tree {
public var arrayColl:ArrayCollection;
and i call this tree from mxml as follows:
<customTree:MyTree
arrayColl={list}
xmlns:customTree="../../.*"/>
Though my 'list' collections is not null, when i place an
alert in the constructor of extended tree class
it shows as null.
Please advice.
Thanks,
Luckybelow is the canvas:
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="
http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
import mx.collections.IViewCursor;
import mx.collections.ArrayCollection;
import com.citi.ascript.TreeData;
import mx.controls.Alert;
import com.citi.ascript.CitiTree;
public var availableTreeDataColl:ArrayCollection;
public var selectedTreeDataColl:ArrayCollection;
public var treeData:TreeData;
public var srcTree:CitiTree;
public var availableTreeDataArray:Array = [{a:1},
{b:2},
{c:3}
public function formTreeData():void {
var tempColl:ArrayCollection = new
ArrayCollection(availableTreeDataArray);
availableTreeDataColl = new ArrayCollection();
for (var i:int=0; i<tempColl.length; i++) {
var tempTreeData:Object = tempColl
treeData = new TreeData();
treeData.a = tempTreeData.a;
treeData.b = tempTreeData.b;
treeData.c = tempTreeData.c;
availableTreeDataColl.addItem(treeData);
]]>
</mx:Script>
<mx:VBox>
<mx:Label text="Drag & Drop the analysis sections
that you would like to include in the report" width="450"
height="20"/>
<mx:HBox id="treeContainer"
creationComplete="formTreeData();">
<customTree:MyTree treeList={availableTreeDataColl} //
here collection becomes null.
</customTree:MyTree>
</mx:HBox>
</mx:VBox>
</mx:Canvas>
The collection of TreeData is iterated in the customTree to
form xml which will act as dataprovider for tree.
and this canvas is added as a child for a panel in my main
application.
Hope this gives an idea.
Thanks,
Lucky -
How to map a custom enum list to a custom form property in an extended incident class
Hi,
I'm struggeling to understand how to map a custom enum list to a custom form property in an extended incident class.
Here's what i want to have happen:
I am going to publish a request offering on my SMPortal for allowing users to submit basic IT incidents. I want the form to include "Whom does this problem affect" (answers(This is the custom enum list): Me, Multiple Users, Whole department or Whole
company), "What is the problem about", "Description" and "Attachments".
Here's what i've done:
In the authoring tool i created a MP for the custom enum list and put only the list in it. I sealed the MP and imported it.
I created another unsealed MP called TST.Incident.Library for storing incident library customizations and extended the incident class to add an extension class i called ClassExtension_Affected scope with a custom property i called AffectedScope. Then i am trying
to set the datatype of this property to "list". In the "select a list" dialog i cannot chose my previously sealed MP with the custom enum list in it. Why?
- Do i need to scratch the sealed MP and put the custom enum list in the latter TST.Incident.Library MP instead?
- If so, can i do that and keep this MP unsealed, or will i get an error on import saying "Unsealed management packs should not contain type definitions"
- Should i create one sealed MP for both the custom enum list and the extension class + custom property?Hi,
Authoring Tool simply isn't informed about your list. Open the sealed management pack where you define the root of the list in the Authoring Tool and in the same time open TST.Incident.Library. You will have two opened MPs in the Authoring
Tool and be able to add a custom list for your custom field.
Cheers,
Marat
Site: www.scutils.com Twitter:
LinkedIn:
Facebook: -
Abstract class extends other class?
What happens when a abstract class extends other class?
How can we use the abstract class late in other class?
Why do we need an abstract class that extends other class?
for example:-
public abstract class ABC extends EFG {
public class EFG{
private String name="";
private int rollno="";
private void setName(int name)
this.name=name;
private String getName()
return this.name;
}shafiur wrote:
What happens when a abstract class extends other class?Nothing special. You have defined an abstract class.
How can we use the abstract class late in other class?Define "Late". What "other class"?
Why do we need an abstract class that extends other class?Because it can be useful to define one. -
How to extend a class in same package
I have a class called LoginBean.java which extends the class ConnectDB.java
this both files have a statement both the classes are under the directory pmtools.
and both are included in package pmtools.
(they both have statement "package pmtools; " at top)
when i am trying to compile LoginBean.java, it is giving me following error,
LoginBean.java:7: cannot resolve symbol
symbol : class ConnectDB
location: class pmtools.LoginBean
public class LoginBean extends ConnectDB
^
LoginBean.java:59: cannot resolve symbol
symbol : variable dbConn
location: class pmtools.LoginBean
stmt = dbConn.createStatement();
^
2 errorsdid you compile the other class already? donnow if ithahahaha!!!!!
ok include the import statement
import pmtools.ConnectDB;
in the second class and than compile.. -
Extend base class to customize some properties
Hi
Using Jdev 11g
I need to extend UIGraph class to change the defualt color of pie graph . anyone have a solution to it ? i already extend the class but i donot know what is next steps and what is the method i must to override ??Hi frank
how can i use skinning to change default color of pie chart . for example i have 5 status and count them for every emp but i need specified color for every status ( green for done , red for not done ans so on) if one status missing ( the emp have not (,done status) for example) then the pie color rearranged for other status ???:)). i try to change color in EL but color attr of pie series donot support EL -
How to Extend Java class in UI Module
Hi All,
I am trying to make z for one of the java file GenericSearchDynamicContent.java in the standard package com.sap.wec.app.common.module.catalog.ui.utils. Can anyone please let me know what are steps do i need to follow to extend the same java file in our customer namespace and make use of it.
Thanks in Advance.
Regards,
Rahul.Hi Rahul,
It's upto you whether you want to keep seprate packages for custom changes (then create your own package and keep all the Z class under this) or create a Z_GenericSearchDynamicContent.java and extend this class by GenericSearchDynamicContent.java.
After doing this you can make your custom changes accordingly and you have to also make the changes in *config.xml (replace this entry GenericSearchDynamicContent by Z_GenericSearchDynamicContent.java.) files as mapping is done there.
Could you please let me know if you need any further information.
Thanks,
Hamendra -
Implementation of DragManager in extended Panel class
Hi,
I'm facing a problem during implementation of DragManager in
extended Panel class. I've a component which is extending the Panel
class where I've attached four Images with their corresponding
dragging features.
Say, the four images' x positions as these: x1 = 10, x2 = 20,
x3 = 30, x4 = 40. After adding the DragManger class and
implementation of dragging feature to those Images, the dragging is
works fine. But, the problem is, when I'm dragging x1 image, the
imageProxy associated to x1 starts showing from exactly the x1
position, but also all the three images' (x2, x3, x4) imageProxy
starts dragging from x1 position only! When the expected result is,
the x2 imageProxy shud starts drag from x2 x position itself, and
for other x3 imageProxy from x3 position and x4 is their also.
Except the x1 image, all the other three's imageProxy are not
starts from their respective image x position.
Anyone can give any idea.. how to overcome this?
tnks.
ASBWhat are the:
DragManager.doDrag(initiator, ds, event, imageProxy, x, y,
1.0);
x and y parameters in your drag manager's doDrag method? They
should be calculated from the point of mouse click that would
event.localX and event.localY.
ATTA -
Package.Class extends Package.Class ??
Is there any way I can make a class in a package extend another class in the same package://---- File: JrcCode1.java
package jrc;
public class JrcCode1 {
public JrcCode1() {
System.out.println("JrcCode1");
//---- File: JrcCode2.java
package jrc;
public class JrcCode2 extends JrcCode1 { //cannot resolve symbol, class JrcCode1
public JrcCode2() {
super();
System.out.println("JrcCode2");
}Thanks,
JamesThe current directory is not automatically in the classpath.
You have to set it up that way. That may be your problemI have tried doing this, and it's still the same! The first code compiles but the second code fails:
javac -sourcepath . -classpath . JrcCode1.java
javac -sourcepath . -classpath . JrcCode2.java
Try extending jrc.JrcCode1. It might work, but i didnt test it outI have tried this, and it still fails:
JrcCode2.java:3: cannot resolve symbol
symbol : class JrcCode1
location: package jrc
public class JrcCode2 extends jrc.JrcCode1 {
Any other ideas?
Thanks alot!
James -
Implemenet/Extend interface/class in default package
Filename: DeaultInterface.java
public interface DefaultInterface {
// Abstract Methods...
Filename: ConcreteClass.java
package com.company;
import DefaultInterface;
public class ConcreteClass implements DefaultInterface {
// Implementation of Abstract Methods...
}When I compile above java code it gives error "cannot find symbol. symbol: class DefaultInterface".
Can anyone explain why can't we implement the interface/extend the class in default package(no package)?
Edited by: 974531 on Dec 2, 2012 11:07 PM>
When I compile above java code it gives error "cannot find symbol. symbol: class DefaultInterface".
Can anyone explain why can't we implement the interface/extend the class in default package(no package)?
>
You CAN implement the interface defined in the default package.
What you CANNOT do is import it. And that is because the Java Language Specification specifies that named types can only be referenced by their simple name if they are imported and must otherwise be referenced by their fully qualified name.
See the 7.5 Import Declarations in the Java Language Specification - http://docs.oracle.com/javase/specs/jls/se7/html/jls-7.html
>
An import declaration allows a named type or a static member to be referred to by a simple name (§6.2) that consists of a single identifier.
Without the use of an appropriate import declaration, the only way to refer to a type declared in another package, or a static member of another type, is to use a fully qualified name (§6.7).
A type in an unnamed package (§7.4.2) has no canonical name, so the requirement for a canonical name in every kind of import declaration implies that (a) types in an unnamed package cannot be imported, and (b) static members of types in an unnamed package cannot be imported. As such, §7.5.1, §7.5.2, §7.5.3, and §7.5.4 all require a compile-time error on any attempt to import a type (or static member thereof) in an unnamed package.
>
So you can't reference that type by importing it because you can't import a type that doesn't have a canonical nmae. And you can't just use the simple name because, as the first statement above says you have to import it to use the simple name.
When you use the simple name of that type without an import the simple name would refer to a class IN your 'com.company' named package.
Maybe you are looking for
-
How to find out the name of the executable
hi, say, i have an executable jar called Hello.jar. how do i know the name "Hello.jar" in main() when the executable jar is launched. that is, if i rename Hello.jar to HelloWorld.jar, how can main() know about this? this matters because i want to run
-
Messages downloaded many times
Mail keeps getting my messages multiple times. I can end up with 20 of the same email marked unread in the Inbox. I need to leave them on the server so I can also retrieve on my MacBook. I have 2 accounts - Different servers, same thing happens with
-
Save PDF to folder as JPG not working....
I can't figure out why all of a sudden Aperture book pages exported as JPG's aren't showing up anywhere. I did change the dpi setting to 300 and have successfully exported other books recently, but today I finished a book layout and wanted to export
-
Can i make a button change anchor link when you scroll down the site?
I am trying to make a scroll site.. and i have navigation buttons on the right, a full menu, but also a "1 topic up" button and "1 topic down" button. Is there any way that i can have those buttons change anchor link when you scroll down the site. Ex
-
How to filter results from 4 dynamic list menus depandant on how many of them are selected
I have a search page with a form with 4 list menus and 1 submit that post the results to the results page. I can create a record set that either retrieves the correct data from my database if a selection is made from all four menus Or i can create th